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

/**
 * Linked to core.admin.pas.DischargedEpisode business object (ID: 1014100006).
 */
public class DischargedEpisodeADTVo extends ims.core.admin.pas.vo.DischargedEpisodeRefVo implements ims.vo.ImsCloneable, Comparable, ims.vo.interfaces.IGenericItemType
{
	private static final long serialVersionUID = 1L;

	public DischargedEpisodeADTVo()
	{
	}
	public DischargedEpisodeADTVo(Integer id, int version)
	{
		super(id, version);
	}
	public DischargedEpisodeADTVo(ims.core.vo.beans.DischargedEpisodeADTVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : bean.getPasEvent().buildVo();
		if(bean.getWardStays() != null)
		{
			this.wardstays = new ims.core.admin.pas.vo.WardStayRefVoCollection();
			for(int wardstays_i = 0; wardstays_i < bean.getWardStays().length; wardstays_i++)
			{
				this.wardstays.add(new ims.core.admin.pas.vo.WardStayRefVo(new Integer(bean.getWardStays()[wardstays_i].getId()), bean.getWardStays()[wardstays_i].getVersion()));
			}
		}
		if(bean.getConsultantStays() != null)
		{
			this.consultantstays = new ims.core.admin.pas.vo.ConsultantStayRefVoCollection();
			for(int consultantstays_i = 0; consultantstays_i < bean.getConsultantStays().length; consultantstays_i++)
			{
				this.consultantstays.add(new ims.core.admin.pas.vo.ConsultantStayRefVo(new Integer(bean.getConsultantStays()[consultantstays_i].getId()), bean.getConsultantStays()[consultantstays_i].getVersion()));
			}
		}
		this.dischargedatetime = bean.getDischargeDateTime() == null ? null : bean.getDischargeDateTime().buildDateTime();
		this.isactive = bean.getIsActive();
		this.dischargedestination = bean.getDischargeDestination() == null ? null : ims.coe.vo.lookups.DischargeDestination.buildLookup(bean.getDischargeDestination());
		this.methodofdischarge = bean.getMethodOfDischarge() == null ? null : ims.core.vo.lookups.MethodOfDischarge.buildLookup(bean.getMethodOfDischarge());
		this.wastreatmentdeferred = bean.getWasTreatmentDeferred();
		this.eighteenweekclockstopped = bean.getEighteenWeekClockStopped();
		this.bedspaceforinfant = bean.getBedSpaceForInfant() == null ? null : bean.getBedSpaceForInfant().buildVo();
		this.dischargereadydate = bean.getDischargeReadyDate() == null ? null : bean.getDischargeReadyDate().buildDate();
		this.admissiondetail = bean.getAdmissionDetail() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetail().getId()), bean.getAdmissionDetail().getVersion());
		this.vteassessmentstatus = bean.getVTEAssessmentStatus() == null ? null : ims.clinical.vo.lookups.VTEAsessmentStatus.buildLookup(bean.getVTEAssessmentStatus());
		this.vteriskassessment = bean.getVTERiskAssessment() == null ? null : new ims.core.clinical.vo.VTERiskAssessmentRefVo(new Integer(bean.getVTERiskAssessment().getId()), bean.getVTERiskAssessment().getVersion());
		this.wasdiagnosticdeferred = bean.getWasDiagnosticDeferred();
		this.wastreatmentgiven = bean.getWasTreatmentGiven();
		this.deferredreason = bean.getDeferredReason() == null ? null : ims.scheduling.vo.lookups.CancelAppointmentReason.buildLookup(bean.getDeferredReason());
		this.deferredreasonconfig = bean.getDeferredReasonConfig() == null ? null : bean.getDeferredReasonConfig().buildVo();
		this.dischargingward = bean.getDischargingWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getDischargingWard().getId()), bean.getDischargingWard().getVersion());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.DischargedEpisodeADTVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : bean.getPasEvent().buildVo(map);
		if(bean.getWardStays() != null)
		{
			this.wardstays = new ims.core.admin.pas.vo.WardStayRefVoCollection();
			for(int wardstays_i = 0; wardstays_i < bean.getWardStays().length; wardstays_i++)
			{
				this.wardstays.add(new ims.core.admin.pas.vo.WardStayRefVo(new Integer(bean.getWardStays()[wardstays_i].getId()), bean.getWardStays()[wardstays_i].getVersion()));
			}
		}
		if(bean.getConsultantStays() != null)
		{
			this.consultantstays = new ims.core.admin.pas.vo.ConsultantStayRefVoCollection();
			for(int consultantstays_i = 0; consultantstays_i < bean.getConsultantStays().length; consultantstays_i++)
			{
				this.consultantstays.add(new ims.core.admin.pas.vo.ConsultantStayRefVo(new Integer(bean.getConsultantStays()[consultantstays_i].getId()), bean.getConsultantStays()[consultantstays_i].getVersion()));
			}
		}
		this.dischargedatetime = bean.getDischargeDateTime() == null ? null : bean.getDischargeDateTime().buildDateTime();
		this.isactive = bean.getIsActive();
		this.dischargedestination = bean.getDischargeDestination() == null ? null : ims.coe.vo.lookups.DischargeDestination.buildLookup(bean.getDischargeDestination());
		this.methodofdischarge = bean.getMethodOfDischarge() == null ? null : ims.core.vo.lookups.MethodOfDischarge.buildLookup(bean.getMethodOfDischarge());
		this.wastreatmentdeferred = bean.getWasTreatmentDeferred();
		this.eighteenweekclockstopped = bean.getEighteenWeekClockStopped();
		this.bedspaceforinfant = bean.getBedSpaceForInfant() == null ? null : bean.getBedSpaceForInfant().buildVo(map);
		this.dischargereadydate = bean.getDischargeReadyDate() == null ? null : bean.getDischargeReadyDate().buildDate();
		this.admissiondetail = bean.getAdmissionDetail() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetail().getId()), bean.getAdmissionDetail().getVersion());
		this.vteassessmentstatus = bean.getVTEAssessmentStatus() == null ? null : ims.clinical.vo.lookups.VTEAsessmentStatus.buildLookup(bean.getVTEAssessmentStatus());
		this.vteriskassessment = bean.getVTERiskAssessment() == null ? null : new ims.core.clinical.vo.VTERiskAssessmentRefVo(new Integer(bean.getVTERiskAssessment().getId()), bean.getVTERiskAssessment().getVersion());
		this.wasdiagnosticdeferred = bean.getWasDiagnosticDeferred();
		this.wastreatmentgiven = bean.getWasTreatmentGiven();
		this.deferredreason = bean.getDeferredReason() == null ? null : ims.scheduling.vo.lookups.CancelAppointmentReason.buildLookup(bean.getDeferredReason());
		this.deferredreasonconfig = bean.getDeferredReasonConfig() == null ? null : bean.getDeferredReasonConfig().buildVo(map);
		this.dischargingward = bean.getDischargingWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getDischargingWard().getId()), bean.getDischargingWard().getVersion());
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.core.vo.beans.DischargedEpisodeADTVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.DischargedEpisodeADTVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.DischargedEpisodeADTVoBean();
			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("WARDSTAYS"))
			return getWardStays();
		if(fieldName.equals("CONSULTANTSTAYS"))
			return getConsultantStays();
		if(fieldName.equals("DISCHARGEDATETIME"))
			return getDischargeDateTime();
		if(fieldName.equals("ISACTIVE"))
			return getIsActive();
		if(fieldName.equals("DISCHARGEDESTINATION"))
			return getDischargeDestination();
		if(fieldName.equals("METHODOFDISCHARGE"))
			return getMethodOfDischarge();
		if(fieldName.equals("WASTREATMENTDEFERRED"))
			return getWasTreatmentDeferred();
		if(fieldName.equals("EIGHTEENWEEKCLOCKSTOPPED"))
			return getEighteenWeekClockStopped();
		if(fieldName.equals("BEDSPACEFORINFANT"))
			return getBedSpaceForInfant();
		if(fieldName.equals("DISCHARGEREADYDATE"))
			return getDischargeReadyDate();
		if(fieldName.equals("ADMISSIONDETAIL"))
			return getAdmissionDetail();
		if(fieldName.equals("VTEASSESSMENTSTATUS"))
			return getVTEAssessmentStatus();
		if(fieldName.equals("VTERISKASSESSMENT"))
			return getVTERiskAssessment();
		if(fieldName.equals("WASDIAGNOSTICDEFERRED"))
			return getWasDiagnosticDeferred();
		if(fieldName.equals("WASTREATMENTGIVEN"))
			return getWasTreatmentGiven();
		if(fieldName.equals("DEFERREDREASON"))
			return getDeferredReason();
		if(fieldName.equals("DEFERREDREASONCONFIG"))
			return getDeferredReasonConfig();
		if(fieldName.equals("DISCHARGINGWARD"))
			return getDischargingWard();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPasEventIsNotNull()
	{
		return this.pasevent != null;
	}
	public ims.core.vo.PasEventADTVo getPasEvent()
	{
		return this.pasevent;
	}
	public void setPasEvent(ims.core.vo.PasEventADTVo value)
	{
		this.isValidated = false;
		this.pasevent = value;
	}
	public boolean getWardStaysIsNotNull()
	{
		return this.wardstays != null;
	}
	public ims.core.admin.pas.vo.WardStayRefVoCollection getWardStays()
	{
		return this.wardstays;
	}
	public void setWardStays(ims.core.admin.pas.vo.WardStayRefVoCollection value)
	{
		this.isValidated = false;
		this.wardstays = value;
	}
	public boolean getConsultantStaysIsNotNull()
	{
		return this.consultantstays != null;
	}
	public ims.core.admin.pas.vo.ConsultantStayRefVoCollection getConsultantStays()
	{
		return this.consultantstays;
	}
	public void setConsultantStays(ims.core.admin.pas.vo.ConsultantStayRefVoCollection value)
	{
		this.isValidated = false;
		this.consultantstays = value;
	}
	public boolean getDischargeDateTimeIsNotNull()
	{
		return this.dischargedatetime != null;
	}
	public ims.framework.utils.DateTime getDischargeDateTime()
	{
		return this.dischargedatetime;
	}
	public void setDischargeDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.dischargedatetime = value;
	}
	public boolean getIsActiveIsNotNull()
	{
		return this.isactive != null;
	}
	public Boolean getIsActive()
	{
		return this.isactive;
	}
	public void setIsActive(Boolean value)
	{
		this.isValidated = false;
		this.isactive = value;
	}
	public boolean getDischargeDestinationIsNotNull()
	{
		return this.dischargedestination != null;
	}
	public ims.coe.vo.lookups.DischargeDestination getDischargeDestination()
	{
		return this.dischargedestination;
	}
	public void setDischargeDestination(ims.coe.vo.lookups.DischargeDestination value)
	{
		this.isValidated = false;
		this.dischargedestination = value;
	}
	public boolean getMethodOfDischargeIsNotNull()
	{
		return this.methodofdischarge != null;
	}
	public ims.core.vo.lookups.MethodOfDischarge getMethodOfDischarge()
	{
		return this.methodofdischarge;
	}
	public void setMethodOfDischarge(ims.core.vo.lookups.MethodOfDischarge value)
	{
		this.isValidated = false;
		this.methodofdischarge = value;
	}
	public boolean getWasTreatmentDeferredIsNotNull()
	{
		return this.wastreatmentdeferred != null;
	}
	public Boolean getWasTreatmentDeferred()
	{
		return this.wastreatmentdeferred;
	}
	public void setWasTreatmentDeferred(Boolean value)
	{
		this.isValidated = false;
		this.wastreatmentdeferred = value;
	}
	public boolean getEighteenWeekClockStoppedIsNotNull()
	{
		return this.eighteenweekclockstopped != null;
	}
	public Boolean getEighteenWeekClockStopped()
	{
		return this.eighteenweekclockstopped;
	}
	public void setEighteenWeekClockStopped(Boolean value)
	{
		this.isValidated = false;
		this.eighteenweekclockstopped = value;
	}
	public boolean getBedSpaceForInfantIsNotNull()
	{
		return this.bedspaceforinfant != null;
	}
	public ims.core.vo.BedSpaceStateLiteVo getBedSpaceForInfant()
	{
		return this.bedspaceforinfant;
	}
	public void setBedSpaceForInfant(ims.core.vo.BedSpaceStateLiteVo value)
	{
		this.isValidated = false;
		this.bedspaceforinfant = value;
	}
	public boolean getDischargeReadyDateIsNotNull()
	{
		return this.dischargereadydate != null;
	}
	public ims.framework.utils.Date getDischargeReadyDate()
	{
		return this.dischargereadydate;
	}
	public void setDischargeReadyDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dischargereadydate = value;
	}
	public boolean getAdmissionDetailIsNotNull()
	{
		return this.admissiondetail != null;
	}
	public ims.core.admin.pas.vo.AdmissionDetailRefVo getAdmissionDetail()
	{
		return this.admissiondetail;
	}
	public void setAdmissionDetail(ims.core.admin.pas.vo.AdmissionDetailRefVo value)
	{
		this.isValidated = false;
		this.admissiondetail = value;
	}
	public boolean getVTEAssessmentStatusIsNotNull()
	{
		return this.vteassessmentstatus != null;
	}
	public ims.clinical.vo.lookups.VTEAsessmentStatus getVTEAssessmentStatus()
	{
		return this.vteassessmentstatus;
	}
	public void setVTEAssessmentStatus(ims.clinical.vo.lookups.VTEAsessmentStatus value)
	{
		this.isValidated = false;
		this.vteassessmentstatus = value;
	}
	public boolean getVTERiskAssessmentIsNotNull()
	{
		return this.vteriskassessment != null;
	}
	public ims.core.clinical.vo.VTERiskAssessmentRefVo getVTERiskAssessment()
	{
		return this.vteriskassessment;
	}
	public void setVTERiskAssessment(ims.core.clinical.vo.VTERiskAssessmentRefVo value)
	{
		this.isValidated = false;
		this.vteriskassessment = value;
	}
	public boolean getWasDiagnosticDeferredIsNotNull()
	{
		return this.wasdiagnosticdeferred != null;
	}
	public Boolean getWasDiagnosticDeferred()
	{
		return this.wasdiagnosticdeferred;
	}
	public void setWasDiagnosticDeferred(Boolean value)
	{
		this.isValidated = false;
		this.wasdiagnosticdeferred = value;
	}
	public boolean getWasTreatmentGivenIsNotNull()
	{
		return this.wastreatmentgiven != null;
	}
	public Boolean getWasTreatmentGiven()
	{
		return this.wastreatmentgiven;
	}
	public void setWasTreatmentGiven(Boolean value)
	{
		this.isValidated = false;
		this.wastreatmentgiven = value;
	}
	public boolean getDeferredReasonIsNotNull()
	{
		return this.deferredreason != null;
	}
	public ims.scheduling.vo.lookups.CancelAppointmentReason getDeferredReason()
	{
		return this.deferredreason;
	}
	public void setDeferredReason(ims.scheduling.vo.lookups.CancelAppointmentReason value)
	{
		this.isValidated = false;
		this.deferredreason = value;
	}
	public boolean getDeferredReasonConfigIsNotNull()
	{
		return this.deferredreasonconfig != null;
	}
	public ims.scheduling.vo.CancellationTypeReasonVo getDeferredReasonConfig()
	{
		return this.deferredreasonconfig;
	}
	public void setDeferredReasonConfig(ims.scheduling.vo.CancellationTypeReasonVo value)
	{
		this.isValidated = false;
		this.deferredreasonconfig = value;
	}
	public boolean getDischargingWardIsNotNull()
	{
		return this.dischargingward != null;
	}
	public ims.core.resource.place.vo.LocationRefVo getDischargingWard()
	{
		return this.dischargingward;
	}
	public void setDischargingWard(ims.core.resource.place.vo.LocationRefVo value)
	{
		this.isValidated = false;
		this.dischargingward = value;
	}
	/**
	* IGenericItemType interface methods
	*/
	public ims.core.vo.enums.SelectItemType getIGenericItemTypeSelectItemType()
	{
		return ims.core.vo.enums.SelectItemType.DISCHARGE;
	}
	public Integer getIGenericItemInfoID()
	{
		return this.id;
	}
	public String getIGenericItemInfoName()
	{
		return this.pasevent != null && this.pasevent.getPatientIsNotNull()  && this.pasevent.getPatient().getNameIsNotNull() ? this.pasevent.getPatient().getName().toShortForm() : "<name is null>";
	}
	public Boolean getIGenericItemInfoIsActive()
	{
		return this.isactive;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.pasevent != null)
		{
			if(!this.pasevent.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.pasevent != null)
		{
			String[] listOfOtherErrors = this.pasevent.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.dischargedatetime == null)
			listOfErrors.add("Discharge Date/Time is mandatory");
		if(this.dischargedestination == null)
			listOfErrors.add("Discharge Destination is mandatory");
		if(this.methodofdischarge == null)
			listOfErrors.add("Method Of Discharge is mandatory");
		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;
	
		DischargedEpisodeADTVo clone = new DischargedEpisodeADTVo(this.id, this.version);
		
		if(this.pasevent == null)
			clone.pasevent = null;
		else
			clone.pasevent = (ims.core.vo.PasEventADTVo)this.pasevent.clone();
		clone.wardstays = this.wardstays;
		clone.consultantstays = this.consultantstays;
		if(this.dischargedatetime == null)
			clone.dischargedatetime = null;
		else
			clone.dischargedatetime = (ims.framework.utils.DateTime)this.dischargedatetime.clone();
		clone.isactive = this.isactive;
		if(this.dischargedestination == null)
			clone.dischargedestination = null;
		else
			clone.dischargedestination = (ims.coe.vo.lookups.DischargeDestination)this.dischargedestination.clone();
		if(this.methodofdischarge == null)
			clone.methodofdischarge = null;
		else
			clone.methodofdischarge = (ims.core.vo.lookups.MethodOfDischarge)this.methodofdischarge.clone();
		clone.wastreatmentdeferred = this.wastreatmentdeferred;
		clone.eighteenweekclockstopped = this.eighteenweekclockstopped;
		if(this.bedspaceforinfant == null)
			clone.bedspaceforinfant = null;
		else
			clone.bedspaceforinfant = (ims.core.vo.BedSpaceStateLiteVo)this.bedspaceforinfant.clone();
		if(this.dischargereadydate == null)
			clone.dischargereadydate = null;
		else
			clone.dischargereadydate = (ims.framework.utils.Date)this.dischargereadydate.clone();
		clone.admissiondetail = this.admissiondetail;
		if(this.vteassessmentstatus == null)
			clone.vteassessmentstatus = null;
		else
			clone.vteassessmentstatus = (ims.clinical.vo.lookups.VTEAsessmentStatus)this.vteassessmentstatus.clone();
		clone.vteriskassessment = this.vteriskassessment;
		clone.wasdiagnosticdeferred = this.wasdiagnosticdeferred;
		clone.wastreatmentgiven = this.wastreatmentgiven;
		if(this.deferredreason == null)
			clone.deferredreason = null;
		else
			clone.deferredreason = (ims.scheduling.vo.lookups.CancelAppointmentReason)this.deferredreason.clone();
		if(this.deferredreasonconfig == null)
			clone.deferredreasonconfig = null;
		else
			clone.deferredreasonconfig = (ims.scheduling.vo.CancellationTypeReasonVo)this.deferredreasonconfig.clone();
		clone.dischargingward = this.dischargingward;
		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 (!(DischargedEpisodeADTVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A DischargedEpisodeADTVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((DischargedEpisodeADTVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((DischargedEpisodeADTVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.pasevent != null)
			count++;
		if(this.wardstays != null)
			count++;
		if(this.consultantstays != null)
			count++;
		if(this.dischargedatetime != null)
			count++;
		if(this.isactive != null)
			count++;
		if(this.dischargedestination != null)
			count++;
		if(this.methodofdischarge != null)
			count++;
		if(this.wastreatmentdeferred != null)
			count++;
		if(this.eighteenweekclockstopped != null)
			count++;
		if(this.bedspaceforinfant != null)
			count++;
		if(this.dischargereadydate != null)
			count++;
		if(this.admissiondetail != null)
			count++;
		if(this.vteassessmentstatus != null)
			count++;
		if(this.vteriskassessment != null)
			count++;
		if(this.wasdiagnosticdeferred != null)
			count++;
		if(this.wastreatmentgiven != null)
			count++;
		if(this.deferredreason != null)
			count++;
		if(this.deferredreasonconfig != null)
			count++;
		if(this.dischargingward != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 19;
	}
	protected ims.core.vo.PasEventADTVo pasevent;
	protected ims.core.admin.pas.vo.WardStayRefVoCollection wardstays;
	protected ims.core.admin.pas.vo.ConsultantStayRefVoCollection consultantstays;
	protected ims.framework.utils.DateTime dischargedatetime;
	protected Boolean isactive;
	protected ims.coe.vo.lookups.DischargeDestination dischargedestination;
	protected ims.core.vo.lookups.MethodOfDischarge methodofdischarge;
	protected Boolean wastreatmentdeferred;
	protected Boolean eighteenweekclockstopped;
	protected ims.core.vo.BedSpaceStateLiteVo bedspaceforinfant;
	protected ims.framework.utils.Date dischargereadydate;
	protected ims.core.admin.pas.vo.AdmissionDetailRefVo admissiondetail;
	protected ims.clinical.vo.lookups.VTEAsessmentStatus vteassessmentstatus;
	protected ims.core.clinical.vo.VTERiskAssessmentRefVo vteriskassessment;
	protected Boolean wasdiagnosticdeferred;
	protected Boolean wastreatmentgiven;
	protected ims.scheduling.vo.lookups.CancelAppointmentReason deferredreason;
	protected ims.scheduling.vo.CancellationTypeReasonVo deferredreasonconfig;
	protected ims.core.resource.place.vo.LocationRefVo dischargingward;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
