/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/InpatientEpisodeVo.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.Inpatient Episode business object (ID: 1014100000).
 */
public class InpatientEpisodeVo extends ims.core.admin.pas.vo.InpatientEpisodeRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public InpatientEpisodeVo()
	{
	}
	public InpatientEpisodeVo(Integer id, int version)
	{
		super(id, version);
	}
	public InpatientEpisodeVo(ims.core.vo.beans.InpatientEpisodeVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.isonleave = bean.getIsOnLeave();
		this.pasevent = bean.getPasEvent() == null ? null : bean.getPasEvent().buildVo();
		this.comments = bean.getComments();
		this.wardstays = ims.core.vo.WardStayVoCollection.buildFromBeanCollection(bean.getWardStays());
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.estdischargedate = bean.getEstDischargeDate() == null ? null : bean.getEstDischargeDate().buildDateTime();
		this.bedno = bean.getBedNo();
		this.admissiontype = bean.getAdmissionType() == null ? null : ims.core.vo.lookups.AdmissionType.buildLookup(bean.getAdmissionType());
		this.ismaternityinpatient = bean.getIsMaternityInpatient();
		this.ischaplainrequired = bean.getIsChaplainRequired();
		this.methodofadmission = bean.getMethodOfAdmission() == null ? null : ims.core.vo.lookups.MethodOfAdmission.buildLookup(bean.getMethodOfAdmission());
		this.reasonforadmission = bean.getReasonForAdmission();
		this.sourceofadmission = bean.getSourceOfAdmission() == null ? null : ims.core.vo.lookups.SourceOfAdmission.buildLookup(bean.getSourceOfAdmission());
		this.wardtype = bean.getWardType() == null ? null : ims.core.vo.lookups.WardType.buildLookup(bean.getWardType());
		this.preadmitnumber = bean.getPreAdmitNumber();
		this.readmissiontype = bean.getReadmissionType() == null ? null : ims.core.vo.lookups.ReadmissionType.buildLookup(bean.getReadmissionType());
		this.dischargereadydate = bean.getDischargeReadyDate() == null ? null : bean.getDischargeReadyDate().buildDate();
		this.homeleaves = ims.core.vo.HomeLeaveVoCollection.buildFromBeanCollection(bean.getHomeLeaves());
		this.patientstatus = bean.getPatientStatus() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getPatientStatus());
		this.extendeddetails = bean.getExtendedDetails() == null ? null : bean.getExtendedDetails().buildVo();
		this.admissiondetails = bean.getAdmissionDetails() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetails().getId()), bean.getAdmissionDetails().getVersion());
		this.bed = bean.getBed() == null ? null : bean.getBed().buildVo();
		this.wardstatus = bean.getWardStatus() == null ? null : ims.core.vo.lookups.WardBayStatus.buildLookup(bean.getWardStatus());
		this.transferreason = bean.getTransferReason() == null ? null : ims.core.vo.lookups.TransferReason.buildLookup(bean.getTransferReason());
		this.transfercomment = bean.getTransferComment();
		this.admissiondetailupdates = bean.getAdmissionDetailUpdates() == null ? null : bean.getAdmissionDetailUpdates().buildVo();
		this.consultantstays = ims.core.vo.ConsultantStayVoCollection.buildFromBeanCollection(bean.getConsultantStays());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.InpatientEpisodeVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.isonleave = bean.getIsOnLeave();
		this.pasevent = bean.getPasEvent() == null ? null : bean.getPasEvent().buildVo(map);
		this.comments = bean.getComments();
		this.wardstays = ims.core.vo.WardStayVoCollection.buildFromBeanCollection(bean.getWardStays());
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.estdischargedate = bean.getEstDischargeDate() == null ? null : bean.getEstDischargeDate().buildDateTime();
		this.bedno = bean.getBedNo();
		this.admissiontype = bean.getAdmissionType() == null ? null : ims.core.vo.lookups.AdmissionType.buildLookup(bean.getAdmissionType());
		this.ismaternityinpatient = bean.getIsMaternityInpatient();
		this.ischaplainrequired = bean.getIsChaplainRequired();
		this.methodofadmission = bean.getMethodOfAdmission() == null ? null : ims.core.vo.lookups.MethodOfAdmission.buildLookup(bean.getMethodOfAdmission());
		this.reasonforadmission = bean.getReasonForAdmission();
		this.sourceofadmission = bean.getSourceOfAdmission() == null ? null : ims.core.vo.lookups.SourceOfAdmission.buildLookup(bean.getSourceOfAdmission());
		this.wardtype = bean.getWardType() == null ? null : ims.core.vo.lookups.WardType.buildLookup(bean.getWardType());
		this.preadmitnumber = bean.getPreAdmitNumber();
		this.readmissiontype = bean.getReadmissionType() == null ? null : ims.core.vo.lookups.ReadmissionType.buildLookup(bean.getReadmissionType());
		this.dischargereadydate = bean.getDischargeReadyDate() == null ? null : bean.getDischargeReadyDate().buildDate();
		this.homeleaves = ims.core.vo.HomeLeaveVoCollection.buildFromBeanCollection(bean.getHomeLeaves());
		this.patientstatus = bean.getPatientStatus() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getPatientStatus());
		this.extendeddetails = bean.getExtendedDetails() == null ? null : bean.getExtendedDetails().buildVo(map);
		this.admissiondetails = bean.getAdmissionDetails() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetails().getId()), bean.getAdmissionDetails().getVersion());
		this.bed = bean.getBed() == null ? null : bean.getBed().buildVo(map);
		this.wardstatus = bean.getWardStatus() == null ? null : ims.core.vo.lookups.WardBayStatus.buildLookup(bean.getWardStatus());
		this.transferreason = bean.getTransferReason() == null ? null : ims.core.vo.lookups.TransferReason.buildLookup(bean.getTransferReason());
		this.transfercomment = bean.getTransferComment();
		this.admissiondetailupdates = bean.getAdmissionDetailUpdates() == null ? null : bean.getAdmissionDetailUpdates().buildVo(map);
		this.consultantstays = ims.core.vo.ConsultantStayVoCollection.buildFromBeanCollection(bean.getConsultantStays());
	}
	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.InpatientEpisodeVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.InpatientEpisodeVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.InpatientEpisodeVoBean();
			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("ISONLEAVE"))
			return getIsOnLeave();
		if(fieldName.equals("PASEVENT"))
			return getPasEvent();
		if(fieldName.equals("COMMENTS"))
			return getComments();
		if(fieldName.equals("WARDSTAYS"))
			return getWardStays();
		if(fieldName.equals("ADMISSIONDATETIME"))
			return getAdmissionDateTime();
		if(fieldName.equals("ESTDISCHARGEDATE"))
			return getEstDischargeDate();
		if(fieldName.equals("BEDNO"))
			return getBedNo();
		if(fieldName.equals("ADMISSIONTYPE"))
			return getAdmissionType();
		if(fieldName.equals("ISMATERNITYINPATIENT"))
			return getIsMaternityInpatient();
		if(fieldName.equals("ISCHAPLAINREQUIRED"))
			return getIsChaplainRequired();
		if(fieldName.equals("METHODOFADMISSION"))
			return getMethodOfAdmission();
		if(fieldName.equals("REASONFORADMISSION"))
			return getReasonForAdmission();
		if(fieldName.equals("SOURCEOFADMISSION"))
			return getSourceOfAdmission();
		if(fieldName.equals("WARDTYPE"))
			return getWardType();
		if(fieldName.equals("PREADMITNUMBER"))
			return getPreAdmitNumber();
		if(fieldName.equals("READMISSIONTYPE"))
			return getReadmissionType();
		if(fieldName.equals("DISCHARGEREADYDATE"))
			return getDischargeReadyDate();
		if(fieldName.equals("HOMELEAVES"))
			return getHomeLeaves();
		if(fieldName.equals("PATIENTSTATUS"))
			return getPatientStatus();
		if(fieldName.equals("EXTENDEDDETAILS"))
			return getExtendedDetails();
		if(fieldName.equals("ADMISSIONDETAILS"))
			return getAdmissionDetails();
		if(fieldName.equals("BED"))
			return getBed();
		if(fieldName.equals("WARDSTATUS"))
			return getWardStatus();
		if(fieldName.equals("TRANSFERREASON"))
			return getTransferReason();
		if(fieldName.equals("TRANSFERCOMMENT"))
			return getTransferComment();
		if(fieldName.equals("ADMISSIONDETAILUPDATES"))
			return getAdmissionDetailUpdates();
		if(fieldName.equals("CONSULTANTSTAYS"))
			return getConsultantStays();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getIsOnLeaveIsNotNull()
	{
		return this.isonleave != null;
	}
	public Boolean getIsOnLeave()
	{
		return this.isonleave;
	}
	public void setIsOnLeave(Boolean value)
	{
		this.isValidated = false;
		this.isonleave = value;
	}
	public boolean getPasEventIsNotNull()
	{
		return this.pasevent != null;
	}
	public ims.core.vo.PasEventVo getPasEvent()
	{
		return this.pasevent;
	}
	public void setPasEvent(ims.core.vo.PasEventVo value)
	{
		this.isValidated = false;
		this.pasevent = value;
	}
	public boolean getCommentsIsNotNull()
	{
		return this.comments != null;
	}
	public String getComments()
	{
		return this.comments;
	}
	public static int getCommentsMaxLength()
	{
		return 1500;
	}
	public void setComments(String value)
	{
		this.isValidated = false;
		this.comments = value;
	}
	public boolean getWardStaysIsNotNull()
	{
		return this.wardstays != null;
	}
	public ims.core.vo.WardStayVoCollection getWardStays()
	{
		return this.wardstays;
	}
	public void setWardStays(ims.core.vo.WardStayVoCollection value)
	{
		this.isValidated = false;
		this.wardstays = value;
	}
	public boolean getAdmissionDateTimeIsNotNull()
	{
		return this.admissiondatetime != null;
	}
	public ims.framework.utils.DateTime getAdmissionDateTime()
	{
		return this.admissiondatetime;
	}
	public void setAdmissionDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.admissiondatetime = value;
	}
	public boolean getEstDischargeDateIsNotNull()
	{
		return this.estdischargedate != null;
	}
	public ims.framework.utils.DateTime getEstDischargeDate()
	{
		return this.estdischargedate;
	}
	public void setEstDischargeDate(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.estdischargedate = value;
	}
	public boolean getBedNoIsNotNull()
	{
		return this.bedno != null;
	}
	public String getBedNo()
	{
		return this.bedno;
	}
	public static int getBedNoMaxLength()
	{
		return 10;
	}
	public void setBedNo(String value)
	{
		this.isValidated = false;
		this.bedno = value;
	}
	public boolean getAdmissionTypeIsNotNull()
	{
		return this.admissiontype != null;
	}
	public ims.core.vo.lookups.AdmissionType getAdmissionType()
	{
		return this.admissiontype;
	}
	public void setAdmissionType(ims.core.vo.lookups.AdmissionType value)
	{
		this.isValidated = false;
		this.admissiontype = value;
	}
	public boolean getIsMaternityInpatientIsNotNull()
	{
		return this.ismaternityinpatient != null;
	}
	public Boolean getIsMaternityInpatient()
	{
		return this.ismaternityinpatient;
	}
	public void setIsMaternityInpatient(Boolean value)
	{
		this.isValidated = false;
		this.ismaternityinpatient = value;
	}
	public boolean getIsChaplainRequiredIsNotNull()
	{
		return this.ischaplainrequired != null;
	}
	public Boolean getIsChaplainRequired()
	{
		return this.ischaplainrequired;
	}
	public void setIsChaplainRequired(Boolean value)
	{
		this.isValidated = false;
		this.ischaplainrequired = value;
	}
	public boolean getMethodOfAdmissionIsNotNull()
	{
		return this.methodofadmission != null;
	}
	public ims.core.vo.lookups.MethodOfAdmission getMethodOfAdmission()
	{
		return this.methodofadmission;
	}
	public void setMethodOfAdmission(ims.core.vo.lookups.MethodOfAdmission value)
	{
		this.isValidated = false;
		this.methodofadmission = value;
	}
	public boolean getReasonForAdmissionIsNotNull()
	{
		return this.reasonforadmission != null;
	}
	public String getReasonForAdmission()
	{
		return this.reasonforadmission;
	}
	public static int getReasonForAdmissionMaxLength()
	{
		return 255;
	}
	public void setReasonForAdmission(String value)
	{
		this.isValidated = false;
		this.reasonforadmission = value;
	}
	public boolean getSourceOfAdmissionIsNotNull()
	{
		return this.sourceofadmission != null;
	}
	public ims.core.vo.lookups.SourceOfAdmission getSourceOfAdmission()
	{
		return this.sourceofadmission;
	}
	public void setSourceOfAdmission(ims.core.vo.lookups.SourceOfAdmission value)
	{
		this.isValidated = false;
		this.sourceofadmission = value;
	}
	public boolean getWardTypeIsNotNull()
	{
		return this.wardtype != null;
	}
	public ims.core.vo.lookups.WardType getWardType()
	{
		return this.wardtype;
	}
	public void setWardType(ims.core.vo.lookups.WardType value)
	{
		this.isValidated = false;
		this.wardtype = value;
	}
	public boolean getPreAdmitNumberIsNotNull()
	{
		return this.preadmitnumber != null;
	}
	public String getPreAdmitNumber()
	{
		return this.preadmitnumber;
	}
	public static int getPreAdmitNumberMaxLength()
	{
		return 255;
	}
	public void setPreAdmitNumber(String value)
	{
		this.isValidated = false;
		this.preadmitnumber = value;
	}
	public boolean getReadmissionTypeIsNotNull()
	{
		return this.readmissiontype != null;
	}
	public ims.core.vo.lookups.ReadmissionType getReadmissionType()
	{
		return this.readmissiontype;
	}
	public void setReadmissionType(ims.core.vo.lookups.ReadmissionType value)
	{
		this.isValidated = false;
		this.readmissiontype = 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 getHomeLeavesIsNotNull()
	{
		return this.homeleaves != null;
	}
	public ims.core.vo.HomeLeaveVoCollection getHomeLeaves()
	{
		return this.homeleaves;
	}
	public void setHomeLeaves(ims.core.vo.HomeLeaveVoCollection value)
	{
		this.isValidated = false;
		this.homeleaves = value;
	}
	public boolean getPatientStatusIsNotNull()
	{
		return this.patientstatus != null;
	}
	public ims.core.vo.lookups.PatientStatus getPatientStatus()
	{
		return this.patientstatus;
	}
	public void setPatientStatus(ims.core.vo.lookups.PatientStatus value)
	{
		this.isValidated = false;
		this.patientstatus = value;
	}
	public boolean getExtendedDetailsIsNotNull()
	{
		return this.extendeddetails != null;
	}
	public ims.core.vo.ExtendedAdmissionDetailVo getExtendedDetails()
	{
		return this.extendeddetails;
	}
	public void setExtendedDetails(ims.core.vo.ExtendedAdmissionDetailVo value)
	{
		this.isValidated = false;
		this.extendeddetails = value;
	}
	public boolean getAdmissionDetailsIsNotNull()
	{
		return this.admissiondetails != null;
	}
	public ims.core.admin.pas.vo.AdmissionDetailRefVo getAdmissionDetails()
	{
		return this.admissiondetails;
	}
	public void setAdmissionDetails(ims.core.admin.pas.vo.AdmissionDetailRefVo value)
	{
		this.isValidated = false;
		this.admissiondetails = value;
	}
	public boolean getBedIsNotNull()
	{
		return this.bed != null;
	}
	public ims.core.vo.BedSpaceStateLiteVo getBed()
	{
		return this.bed;
	}
	public void setBed(ims.core.vo.BedSpaceStateLiteVo value)
	{
		this.isValidated = false;
		this.bed = value;
	}
	public boolean getWardStatusIsNotNull()
	{
		return this.wardstatus != null;
	}
	public ims.core.vo.lookups.WardBayStatus getWardStatus()
	{
		return this.wardstatus;
	}
	public void setWardStatus(ims.core.vo.lookups.WardBayStatus value)
	{
		this.isValidated = false;
		this.wardstatus = value;
	}
	public boolean getTransferReasonIsNotNull()
	{
		return this.transferreason != null;
	}
	public ims.core.vo.lookups.TransferReason getTransferReason()
	{
		return this.transferreason;
	}
	public void setTransferReason(ims.core.vo.lookups.TransferReason value)
	{
		this.isValidated = false;
		this.transferreason = value;
	}
	public boolean getTransferCommentIsNotNull()
	{
		return this.transfercomment != null;
	}
	public String getTransferComment()
	{
		return this.transfercomment;
	}
	public static int getTransferCommentMaxLength()
	{
		return 255;
	}
	public void setTransferComment(String value)
	{
		this.isValidated = false;
		this.transfercomment = value;
	}
	public boolean getAdmissionDetailUpdatesIsNotNull()
	{
		return this.admissiondetailupdates != null;
	}
	public ims.core.vo.AdmissionDetailForADTUpdateAdmissionVo getAdmissionDetailUpdates()
	{
		return this.admissiondetailupdates;
	}
	public void setAdmissionDetailUpdates(ims.core.vo.AdmissionDetailForADTUpdateAdmissionVo value)
	{
		this.isValidated = false;
		this.admissiondetailupdates = value;
	}
	public boolean getConsultantStaysIsNotNull()
	{
		return this.consultantstays != null;
	}
	public ims.core.vo.ConsultantStayVoCollection getConsultantStays()
	{
		return this.consultantstays;
	}
	public void setConsultantStays(ims.core.vo.ConsultantStayVoCollection value)
	{
		this.isValidated = false;
		this.consultantstays = value;
	}
	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;
			}
		}
		if(this.wardstays != null)
		{
			if(!this.wardstays.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.extendeddetails != null)
		{
			if(!this.extendeddetails.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.consultantstays != null)
		{
			if(!this.consultantstays.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)
		{
			String[] listOfOtherErrors = this.pasevent.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.comments != null)
			if(this.comments.length() > 1500)
				listOfErrors.add("The length of the field [comments] in the value object [ims.core.vo.InpatientEpisodeVo] is too big. It should be less or equal to 1500");
		if(this.wardstays != null)
		{
			String[] listOfOtherErrors = this.wardstays.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.bedno != null)
			if(this.bedno.length() > 10)
				listOfErrors.add("The length of the field [bedno] in the value object [ims.core.vo.InpatientEpisodeVo] is too big. It should be less or equal to 10");
		if(this.reasonforadmission != null)
			if(this.reasonforadmission.length() > 255)
				listOfErrors.add("The length of the field [reasonforadmission] in the value object [ims.core.vo.InpatientEpisodeVo] is too big. It should be less or equal to 255");
		if(this.extendeddetails != null)
		{
			String[] listOfOtherErrors = this.extendeddetails.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.consultantstays != null)
		{
			String[] listOfOtherErrors = this.consultantstays.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;
	
		InpatientEpisodeVo clone = new InpatientEpisodeVo(this.id, this.version);
		
		clone.isonleave = this.isonleave;
		if(this.pasevent == null)
			clone.pasevent = null;
		else
			clone.pasevent = (ims.core.vo.PasEventVo)this.pasevent.clone();
		clone.comments = this.comments;
		if(this.wardstays == null)
			clone.wardstays = null;
		else
			clone.wardstays = (ims.core.vo.WardStayVoCollection)this.wardstays.clone();
		if(this.admissiondatetime == null)
			clone.admissiondatetime = null;
		else
			clone.admissiondatetime = (ims.framework.utils.DateTime)this.admissiondatetime.clone();
		if(this.estdischargedate == null)
			clone.estdischargedate = null;
		else
			clone.estdischargedate = (ims.framework.utils.DateTime)this.estdischargedate.clone();
		clone.bedno = this.bedno;
		if(this.admissiontype == null)
			clone.admissiontype = null;
		else
			clone.admissiontype = (ims.core.vo.lookups.AdmissionType)this.admissiontype.clone();
		clone.ismaternityinpatient = this.ismaternityinpatient;
		clone.ischaplainrequired = this.ischaplainrequired;
		if(this.methodofadmission == null)
			clone.methodofadmission = null;
		else
			clone.methodofadmission = (ims.core.vo.lookups.MethodOfAdmission)this.methodofadmission.clone();
		clone.reasonforadmission = this.reasonforadmission;
		if(this.sourceofadmission == null)
			clone.sourceofadmission = null;
		else
			clone.sourceofadmission = (ims.core.vo.lookups.SourceOfAdmission)this.sourceofadmission.clone();
		if(this.wardtype == null)
			clone.wardtype = null;
		else
			clone.wardtype = (ims.core.vo.lookups.WardType)this.wardtype.clone();
		clone.preadmitnumber = this.preadmitnumber;
		if(this.readmissiontype == null)
			clone.readmissiontype = null;
		else
			clone.readmissiontype = (ims.core.vo.lookups.ReadmissionType)this.readmissiontype.clone();
		if(this.dischargereadydate == null)
			clone.dischargereadydate = null;
		else
			clone.dischargereadydate = (ims.framework.utils.Date)this.dischargereadydate.clone();
		if(this.homeleaves == null)
			clone.homeleaves = null;
		else
			clone.homeleaves = (ims.core.vo.HomeLeaveVoCollection)this.homeleaves.clone();
		if(this.patientstatus == null)
			clone.patientstatus = null;
		else
			clone.patientstatus = (ims.core.vo.lookups.PatientStatus)this.patientstatus.clone();
		if(this.extendeddetails == null)
			clone.extendeddetails = null;
		else
			clone.extendeddetails = (ims.core.vo.ExtendedAdmissionDetailVo)this.extendeddetails.clone();
		clone.admissiondetails = this.admissiondetails;
		if(this.bed == null)
			clone.bed = null;
		else
			clone.bed = (ims.core.vo.BedSpaceStateLiteVo)this.bed.clone();
		if(this.wardstatus == null)
			clone.wardstatus = null;
		else
			clone.wardstatus = (ims.core.vo.lookups.WardBayStatus)this.wardstatus.clone();
		if(this.transferreason == null)
			clone.transferreason = null;
		else
			clone.transferreason = (ims.core.vo.lookups.TransferReason)this.transferreason.clone();
		clone.transfercomment = this.transfercomment;
		if(this.admissiondetailupdates == null)
			clone.admissiondetailupdates = null;
		else
			clone.admissiondetailupdates = (ims.core.vo.AdmissionDetailForADTUpdateAdmissionVo)this.admissiondetailupdates.clone();
		if(this.consultantstays == null)
			clone.consultantstays = null;
		else
			clone.consultantstays = (ims.core.vo.ConsultantStayVoCollection)this.consultantstays.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 (!(InpatientEpisodeVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A InpatientEpisodeVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		InpatientEpisodeVo compareObj = (InpatientEpisodeVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getPasEvent() == null && compareObj.getPasEvent() != null)
				return -1;
			if(this.getPasEvent() != null && compareObj.getPasEvent() == null)
				return 1;
			if(this.getPasEvent() != null && compareObj.getPasEvent() != null)
				retVal = this.getPasEvent().compareTo(compareObj.getPasEvent());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.isonleave != null)
			count++;
		if(this.pasevent != null)
			count++;
		if(this.comments != null)
			count++;
		if(this.wardstays != null)
			count++;
		if(this.admissiondatetime != null)
			count++;
		if(this.estdischargedate != null)
			count++;
		if(this.bedno != null)
			count++;
		if(this.admissiontype != null)
			count++;
		if(this.ismaternityinpatient != null)
			count++;
		if(this.ischaplainrequired != null)
			count++;
		if(this.methodofadmission != null)
			count++;
		if(this.reasonforadmission != null)
			count++;
		if(this.sourceofadmission != null)
			count++;
		if(this.wardtype != null)
			count++;
		if(this.preadmitnumber != null)
			count++;
		if(this.readmissiontype != null)
			count++;
		if(this.dischargereadydate != null)
			count++;
		if(this.homeleaves != null)
			count++;
		if(this.patientstatus != null)
			count++;
		if(this.extendeddetails != null)
			count++;
		if(this.admissiondetails != null)
			count++;
		if(this.bed != null)
			count++;
		if(this.wardstatus != null)
			count++;
		if(this.transferreason != null)
			count++;
		if(this.transfercomment != null)
			count++;
		if(this.admissiondetailupdates != null)
			count++;
		if(this.consultantstays != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 27;
	}
	protected Boolean isonleave;
	protected ims.core.vo.PasEventVo pasevent;
	protected String comments;
	protected ims.core.vo.WardStayVoCollection wardstays;
	protected ims.framework.utils.DateTime admissiondatetime;
	protected ims.framework.utils.DateTime estdischargedate;
	protected String bedno;
	protected ims.core.vo.lookups.AdmissionType admissiontype;
	protected Boolean ismaternityinpatient;
	protected Boolean ischaplainrequired;
	protected ims.core.vo.lookups.MethodOfAdmission methodofadmission;
	protected String reasonforadmission;
	protected ims.core.vo.lookups.SourceOfAdmission sourceofadmission;
	protected ims.core.vo.lookups.WardType wardtype;
	protected String preadmitnumber;
	protected ims.core.vo.lookups.ReadmissionType readmissiontype;
	protected ims.framework.utils.Date dischargereadydate;
	protected ims.core.vo.HomeLeaveVoCollection homeleaves;
	protected ims.core.vo.lookups.PatientStatus patientstatus;
	protected ims.core.vo.ExtendedAdmissionDetailVo extendeddetails;
	protected ims.core.admin.pas.vo.AdmissionDetailRefVo admissiondetails;
	protected ims.core.vo.BedSpaceStateLiteVo bed;
	protected ims.core.vo.lookups.WardBayStatus wardstatus;
	protected ims.core.vo.lookups.TransferReason transferreason;
	protected String transfercomment;
	protected ims.core.vo.AdmissionDetailForADTUpdateAdmissionVo admissiondetailupdates;
	protected ims.core.vo.ConsultantStayVoCollection consultantstays;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
