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

/**
 * Linked to OCRR.OrderingResults.OcsOrderSession business object (ID: 1070100000).
 */
public class IfOutOcsOrderVo extends ims.ocrr.orderingresults.vo.OcsOrderSessionRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public IfOutOcsOrderVo()
	{
	}
	public IfOutOcsOrderVo(Integer id, int version)
	{
		super(id, version);
	}
	public IfOutOcsOrderVo(ims.ocs_if.vo.beans.IfOutOcsOrderVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.investigations = ims.ocs_if.vo.IfOrderInvestigationVoCollection.buildFromBeanCollection(bean.getInvestigations());
		this.orderedby = bean.getOrderedBy() == null ? null : bean.getOrderedBy().buildVo();
		this.responsibleclinician = bean.getResponsibleClinician() == null ? null : bean.getResponsibleClinician().buildVo();
		this.responsiblegp = bean.getResponsibleGp() == null ? null : bean.getResponsibleGp().buildVo();
		this.clinicaltrial = bean.getClinicalTrial();
		this.clinicaltrialtxt = bean.getClinicalTrialTxt();
		this.additclinnotes = bean.getAdditClinNotes();
		this.patmobility = bean.getPatMobility() == null ? null : ims.ocrr.vo.lookups.OrderPatMobility.buildLookup(bean.getPatMobility());
		this.ordercategory = bean.getOrderCategory() == null ? null : ims.ocrr.vo.lookups.OrderCategory.buildLookup(bean.getOrderCategory());
		this.specimens = ims.ocs_if.vo.IfOrderSpecimenVoCollection.buildFromBeanCollection(bean.getSpecimens());
		this.wasprocessed = bean.getWasProcessed();
		this.patientclinic = bean.getPatientClinic() == null ? null : bean.getPatientClinic().buildVo();
		this.patientlocation = bean.getPatientLocation() == null ? null : bean.getPatientLocation().buildVo();
		this.reportto = ims.ocrr.vo.OcsReportToVoCollection.buildFromBeanCollection(bean.getReportTo());
		this.patient = bean.getPatient() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getPatient().getId()), bean.getPatient().getVersion());
		this.carecontextpas = bean.getCareContextPas() == null ? null : bean.getCareContextPas().buildVo();
		this.orderinghospital = bean.getOrderingHospital() == null ? null : new ims.core.resource.place.vo.LocSiteRefVo(new Integer(bean.getOrderingHospital().getId()), bean.getOrderingHospital().getVersion());
		this.sendnumber = bean.getSendNumber();
		this.outpatientdept = bean.getOutpatientDept() == null ? null : bean.getOutpatientDept().buildVo();
		this.summaryclinicalinformation = bean.getSummaryClinicalInformation();
		this.bleepextnumber = bean.getBleepExtNumber();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.ocs_if.vo.beans.IfOutOcsOrderVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.investigations = ims.ocs_if.vo.IfOrderInvestigationVoCollection.buildFromBeanCollection(bean.getInvestigations());
		this.orderedby = bean.getOrderedBy() == null ? null : bean.getOrderedBy().buildVo(map);
		this.responsibleclinician = bean.getResponsibleClinician() == null ? null : bean.getResponsibleClinician().buildVo(map);
		this.responsiblegp = bean.getResponsibleGp() == null ? null : bean.getResponsibleGp().buildVo(map);
		this.clinicaltrial = bean.getClinicalTrial();
		this.clinicaltrialtxt = bean.getClinicalTrialTxt();
		this.additclinnotes = bean.getAdditClinNotes();
		this.patmobility = bean.getPatMobility() == null ? null : ims.ocrr.vo.lookups.OrderPatMobility.buildLookup(bean.getPatMobility());
		this.ordercategory = bean.getOrderCategory() == null ? null : ims.ocrr.vo.lookups.OrderCategory.buildLookup(bean.getOrderCategory());
		this.specimens = ims.ocs_if.vo.IfOrderSpecimenVoCollection.buildFromBeanCollection(bean.getSpecimens());
		this.wasprocessed = bean.getWasProcessed();
		this.patientclinic = bean.getPatientClinic() == null ? null : bean.getPatientClinic().buildVo(map);
		this.patientlocation = bean.getPatientLocation() == null ? null : bean.getPatientLocation().buildVo(map);
		this.reportto = ims.ocrr.vo.OcsReportToVoCollection.buildFromBeanCollection(bean.getReportTo());
		this.patient = bean.getPatient() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getPatient().getId()), bean.getPatient().getVersion());
		this.carecontextpas = bean.getCareContextPas() == null ? null : bean.getCareContextPas().buildVo(map);
		this.orderinghospital = bean.getOrderingHospital() == null ? null : new ims.core.resource.place.vo.LocSiteRefVo(new Integer(bean.getOrderingHospital().getId()), bean.getOrderingHospital().getVersion());
		this.sendnumber = bean.getSendNumber();
		this.outpatientdept = bean.getOutpatientDept() == null ? null : bean.getOutpatientDept().buildVo(map);
		this.summaryclinicalinformation = bean.getSummaryClinicalInformation();
		this.bleepextnumber = bean.getBleepExtNumber();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.ocs_if.vo.beans.IfOutOcsOrderVoBean bean = null;
		if(map != null)
			bean = (ims.ocs_if.vo.beans.IfOutOcsOrderVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.ocs_if.vo.beans.IfOutOcsOrderVoBean();
			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("INVESTIGATIONS"))
			return getInvestigations();
		if(fieldName.equals("ORDEREDBY"))
			return getOrderedBy();
		if(fieldName.equals("RESPONSIBLECLINICIAN"))
			return getResponsibleClinician();
		if(fieldName.equals("RESPONSIBLEGP"))
			return getResponsibleGp();
		if(fieldName.equals("CLINICALTRIAL"))
			return getClinicalTrial();
		if(fieldName.equals("CLINICALTRIALTXT"))
			return getClinicalTrialTxt();
		if(fieldName.equals("ADDITCLINNOTES"))
			return getAdditClinNotes();
		if(fieldName.equals("PATMOBILITY"))
			return getPatMobility();
		if(fieldName.equals("ORDERCATEGORY"))
			return getOrderCategory();
		if(fieldName.equals("SPECIMENS"))
			return getSpecimens();
		if(fieldName.equals("WASPROCESSED"))
			return getWasProcessed();
		if(fieldName.equals("PATIENTCLINIC"))
			return getPatientClinic();
		if(fieldName.equals("PATIENTLOCATION"))
			return getPatientLocation();
		if(fieldName.equals("REPORTTO"))
			return getReportTo();
		if(fieldName.equals("PATIENT"))
			return getPatient();
		if(fieldName.equals("CARECONTEXTPAS"))
			return getCareContextPas();
		if(fieldName.equals("ORDERINGHOSPITAL"))
			return getOrderingHospital();
		if(fieldName.equals("SENDNUMBER"))
			return getSendNumber();
		if(fieldName.equals("OUTPATIENTDEPT"))
			return getOutpatientDept();
		if(fieldName.equals("SUMMARYCLINICALINFORMATION"))
			return getSummaryClinicalInformation();
		if(fieldName.equals("BLEEPEXTNUMBER"))
			return getBleepExtNumber();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getInvestigationsIsNotNull()
	{
		return this.investigations != null;
	}
	public ims.ocs_if.vo.IfOrderInvestigationVoCollection getInvestigations()
	{
		return this.investigations;
	}
	public void setInvestigations(ims.ocs_if.vo.IfOrderInvestigationVoCollection value)
	{
		this.isValidated = false;
		this.investigations = value;
	}
	public boolean getOrderedByIsNotNull()
	{
		return this.orderedby != null;
	}
	public ims.core.vo.MemberOfStaffShortVo getOrderedBy()
	{
		return this.orderedby;
	}
	public void setOrderedBy(ims.core.vo.MemberOfStaffShortVo value)
	{
		this.isValidated = false;
		this.orderedby = value;
	}
	public boolean getResponsibleClinicianIsNotNull()
	{
		return this.responsibleclinician != null;
	}
	public ims.core.vo.Hcp getResponsibleClinician()
	{
		return this.responsibleclinician;
	}
	public void setResponsibleClinician(ims.core.vo.Hcp value)
	{
		this.isValidated = false;
		this.responsibleclinician = value;
	}
	public boolean getResponsibleGpIsNotNull()
	{
		return this.responsiblegp != null;
	}
	public ims.core.vo.GpShortVo getResponsibleGp()
	{
		return this.responsiblegp;
	}
	public void setResponsibleGp(ims.core.vo.GpShortVo value)
	{
		this.isValidated = false;
		this.responsiblegp = value;
	}
	public boolean getClinicalTrialIsNotNull()
	{
		return this.clinicaltrial != null;
	}
	public Boolean getClinicalTrial()
	{
		return this.clinicaltrial;
	}
	public void setClinicalTrial(Boolean value)
	{
		this.isValidated = false;
		this.clinicaltrial = value;
	}
	public boolean getClinicalTrialTxtIsNotNull()
	{
		return this.clinicaltrialtxt != null;
	}
	public String getClinicalTrialTxt()
	{
		return this.clinicaltrialtxt;
	}
	public static int getClinicalTrialTxtMaxLength()
	{
		return 150;
	}
	public void setClinicalTrialTxt(String value)
	{
		this.isValidated = false;
		this.clinicaltrialtxt = value;
	}
	public boolean getAdditClinNotesIsNotNull()
	{
		return this.additclinnotes != null;
	}
	public String getAdditClinNotes()
	{
		return this.additclinnotes;
	}
	public static int getAdditClinNotesMaxLength()
	{
		return 4000;
	}
	public void setAdditClinNotes(String value)
	{
		this.isValidated = false;
		this.additclinnotes = value;
	}
	public boolean getPatMobilityIsNotNull()
	{
		return this.patmobility != null;
	}
	public ims.ocrr.vo.lookups.OrderPatMobility getPatMobility()
	{
		return this.patmobility;
	}
	public void setPatMobility(ims.ocrr.vo.lookups.OrderPatMobility value)
	{
		this.isValidated = false;
		this.patmobility = value;
	}
	public boolean getOrderCategoryIsNotNull()
	{
		return this.ordercategory != null;
	}
	public ims.ocrr.vo.lookups.OrderCategory getOrderCategory()
	{
		return this.ordercategory;
	}
	public void setOrderCategory(ims.ocrr.vo.lookups.OrderCategory value)
	{
		this.isValidated = false;
		this.ordercategory = value;
	}
	public boolean getSpecimensIsNotNull()
	{
		return this.specimens != null;
	}
	public ims.ocs_if.vo.IfOrderSpecimenVoCollection getSpecimens()
	{
		return this.specimens;
	}
	public void setSpecimens(ims.ocs_if.vo.IfOrderSpecimenVoCollection value)
	{
		this.isValidated = false;
		this.specimens = value;
	}
	public boolean getWasProcessedIsNotNull()
	{
		return this.wasprocessed != null;
	}
	public Boolean getWasProcessed()
	{
		return this.wasprocessed;
	}
	public void setWasProcessed(Boolean value)
	{
		this.isValidated = false;
		this.wasprocessed = value;
	}
	public boolean getPatientClinicIsNotNull()
	{
		return this.patientclinic != null;
	}
	public ims.core.vo.ClinicLiteVo getPatientClinic()
	{
		return this.patientclinic;
	}
	public void setPatientClinic(ims.core.vo.ClinicLiteVo value)
	{
		this.isValidated = false;
		this.patientclinic = value;
	}
	public boolean getPatientLocationIsNotNull()
	{
		return this.patientlocation != null;
	}
	public ims.core.vo.LocShortMappingsVo getPatientLocation()
	{
		return this.patientlocation;
	}
	public void setPatientLocation(ims.core.vo.LocShortMappingsVo value)
	{
		this.isValidated = false;
		this.patientlocation = value;
	}
	public boolean getReportToIsNotNull()
	{
		return this.reportto != null;
	}
	public ims.ocrr.vo.OcsReportToVoCollection getReportTo()
	{
		return this.reportto;
	}
	public void setReportTo(ims.ocrr.vo.OcsReportToVoCollection value)
	{
		this.isValidated = false;
		this.reportto = value;
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.patient.vo.PatientRefVo getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.patient.vo.PatientRefVo value)
	{
		this.isValidated = false;
		this.patient = value;
	}
	public boolean getCareContextPasIsNotNull()
	{
		return this.carecontextpas != null;
	}
	public ims.core.vo.CareContextPasVo getCareContextPas()
	{
		return this.carecontextpas;
	}
	public void setCareContextPas(ims.core.vo.CareContextPasVo value)
	{
		this.isValidated = false;
		this.carecontextpas = value;
	}
	public boolean getOrderingHospitalIsNotNull()
	{
		return this.orderinghospital != null;
	}
	public ims.core.resource.place.vo.LocSiteRefVo getOrderingHospital()
	{
		return this.orderinghospital;
	}
	public void setOrderingHospital(ims.core.resource.place.vo.LocSiteRefVo value)
	{
		this.isValidated = false;
		this.orderinghospital = value;
	}
	public boolean getSendNumberIsNotNull()
	{
		return this.sendnumber != null;
	}
	public Boolean getSendNumber()
	{
		return this.sendnumber;
	}
	public void setSendNumber(Boolean value)
	{
		this.isValidated = false;
		this.sendnumber = value;
	}
	public boolean getOutpatientDeptIsNotNull()
	{
		return this.outpatientdept != null;
	}
	public ims.core.vo.LocShortMappingsVo getOutpatientDept()
	{
		return this.outpatientdept;
	}
	public void setOutpatientDept(ims.core.vo.LocShortMappingsVo value)
	{
		this.isValidated = false;
		this.outpatientdept = value;
	}
	public boolean getSummaryClinicalInformationIsNotNull()
	{
		return this.summaryclinicalinformation != null;
	}
	public String getSummaryClinicalInformation()
	{
		return this.summaryclinicalinformation;
	}
	public static int getSummaryClinicalInformationMaxLength()
	{
		return 2000;
	}
	public void setSummaryClinicalInformation(String value)
	{
		this.isValidated = false;
		this.summaryclinicalinformation = value;
	}
	public boolean getBleepExtNumberIsNotNull()
	{
		return this.bleepextnumber != null;
	}
	public String getBleepExtNumber()
	{
		return this.bleepextnumber;
	}
	public static int getBleepExtNumberMaxLength()
	{
		return 50;
	}
	public void setBleepExtNumber(String value)
	{
		this.isValidated = false;
		this.bleepextnumber = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.investigations != null)
		{
			if(!this.investigations.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.orderedby != null)
		{
			if(!this.orderedby.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.responsibleclinician != null)
		{
			if(!this.responsibleclinician.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.responsiblegp != null)
		{
			if(!this.responsiblegp.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.specimens != null)
		{
			if(!this.specimens.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.patientclinic != null)
		{
			if(!this.patientclinic.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.patientlocation != null)
		{
			if(!this.patientlocation.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.reportto != null)
		{
			if(!this.reportto.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.carecontextpas != null)
		{
			if(!this.carecontextpas.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.investigations == null || this.investigations.size() == 0)
			listOfErrors.add("Investigations are mandatory");
		if(this.investigations != null)
		{
			String[] listOfOtherErrors = this.investigations.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.orderedby != null)
		{
			String[] listOfOtherErrors = this.orderedby.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.responsibleclinician != null)
		{
			String[] listOfOtherErrors = this.responsibleclinician.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.responsiblegp != null)
		{
			String[] listOfOtherErrors = this.responsiblegp.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.clinicaltrial == null)
			listOfErrors.add("ClinicalTrial is mandatory");
		if(this.clinicaltrialtxt != null)
			if(this.clinicaltrialtxt.length() > 150)
				listOfErrors.add("The length of the field [clinicaltrialtxt] in the value object [ims.ocs_if.vo.IfOutOcsOrderVo] is too big. It should be less or equal to 150");
		if(this.specimens != null)
		{
			String[] listOfOtherErrors = this.specimens.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.wasprocessed == null)
			listOfErrors.add("wasProcessed is mandatory");
		if(this.patientclinic != null)
		{
			String[] listOfOtherErrors = this.patientclinic.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.patientlocation != null)
		{
			String[] listOfOtherErrors = this.patientlocation.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.reportto != null)
		{
			String[] listOfOtherErrors = this.reportto.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.patient == null)
			listOfErrors.add("Patient is mandatory");
		if(this.carecontextpas != null)
		{
			String[] listOfOtherErrors = this.carecontextpas.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.summaryclinicalinformation != null)
			if(this.summaryclinicalinformation.length() > 2000)
				listOfErrors.add("The length of the field [summaryclinicalinformation] in the value object [ims.ocs_if.vo.IfOutOcsOrderVo] is too big. It should be less or equal to 2000");
		if(this.bleepextnumber != null)
			if(this.bleepextnumber.length() > 50)
				listOfErrors.add("The length of the field [bleepextnumber] in the value object [ims.ocs_if.vo.IfOutOcsOrderVo] is too big. It should be less or equal to 50");
		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;
	
		IfOutOcsOrderVo clone = new IfOutOcsOrderVo(this.id, this.version);
		
		if(this.investigations == null)
			clone.investigations = null;
		else
			clone.investigations = (ims.ocs_if.vo.IfOrderInvestigationVoCollection)this.investigations.clone();
		if(this.orderedby == null)
			clone.orderedby = null;
		else
			clone.orderedby = (ims.core.vo.MemberOfStaffShortVo)this.orderedby.clone();
		if(this.responsibleclinician == null)
			clone.responsibleclinician = null;
		else
			clone.responsibleclinician = (ims.core.vo.Hcp)this.responsibleclinician.clone();
		if(this.responsiblegp == null)
			clone.responsiblegp = null;
		else
			clone.responsiblegp = (ims.core.vo.GpShortVo)this.responsiblegp.clone();
		clone.clinicaltrial = this.clinicaltrial;
		clone.clinicaltrialtxt = this.clinicaltrialtxt;
		clone.additclinnotes = this.additclinnotes;
		if(this.patmobility == null)
			clone.patmobility = null;
		else
			clone.patmobility = (ims.ocrr.vo.lookups.OrderPatMobility)this.patmobility.clone();
		if(this.ordercategory == null)
			clone.ordercategory = null;
		else
			clone.ordercategory = (ims.ocrr.vo.lookups.OrderCategory)this.ordercategory.clone();
		if(this.specimens == null)
			clone.specimens = null;
		else
			clone.specimens = (ims.ocs_if.vo.IfOrderSpecimenVoCollection)this.specimens.clone();
		clone.wasprocessed = this.wasprocessed;
		if(this.patientclinic == null)
			clone.patientclinic = null;
		else
			clone.patientclinic = (ims.core.vo.ClinicLiteVo)this.patientclinic.clone();
		if(this.patientlocation == null)
			clone.patientlocation = null;
		else
			clone.patientlocation = (ims.core.vo.LocShortMappingsVo)this.patientlocation.clone();
		if(this.reportto == null)
			clone.reportto = null;
		else
			clone.reportto = (ims.ocrr.vo.OcsReportToVoCollection)this.reportto.clone();
		clone.patient = this.patient;
		if(this.carecontextpas == null)
			clone.carecontextpas = null;
		else
			clone.carecontextpas = (ims.core.vo.CareContextPasVo)this.carecontextpas.clone();
		clone.orderinghospital = this.orderinghospital;
		clone.sendnumber = this.sendnumber;
		if(this.outpatientdept == null)
			clone.outpatientdept = null;
		else
			clone.outpatientdept = (ims.core.vo.LocShortMappingsVo)this.outpatientdept.clone();
		clone.summaryclinicalinformation = this.summaryclinicalinformation;
		clone.bleepextnumber = this.bleepextnumber;
		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 (!(IfOutOcsOrderVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A IfOutOcsOrderVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((IfOutOcsOrderVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((IfOutOcsOrderVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.investigations != null)
			count++;
		if(this.orderedby != null)
			count++;
		if(this.responsibleclinician != null)
			count++;
		if(this.responsiblegp != null)
			count++;
		if(this.clinicaltrial != null)
			count++;
		if(this.clinicaltrialtxt != null)
			count++;
		if(this.additclinnotes != null)
			count++;
		if(this.patmobility != null)
			count++;
		if(this.ordercategory != null)
			count++;
		if(this.specimens != null)
			count++;
		if(this.wasprocessed != null)
			count++;
		if(this.patientclinic != null)
			count++;
		if(this.patientlocation != null)
			count++;
		if(this.reportto != null)
			count++;
		if(this.patient != null)
			count++;
		if(this.carecontextpas != null)
			count++;
		if(this.orderinghospital != null)
			count++;
		if(this.sendnumber != null)
			count++;
		if(this.outpatientdept != null)
			count++;
		if(this.summaryclinicalinformation != null)
			count++;
		if(this.bleepextnumber != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 21;
	}
	protected ims.ocs_if.vo.IfOrderInvestigationVoCollection investigations;
	protected ims.core.vo.MemberOfStaffShortVo orderedby;
	protected ims.core.vo.Hcp responsibleclinician;
	protected ims.core.vo.GpShortVo responsiblegp;
	protected Boolean clinicaltrial;
	protected String clinicaltrialtxt;
	protected String additclinnotes;
	protected ims.ocrr.vo.lookups.OrderPatMobility patmobility;
	protected ims.ocrr.vo.lookups.OrderCategory ordercategory;
	protected ims.ocs_if.vo.IfOrderSpecimenVoCollection specimens;
	protected Boolean wasprocessed;
	protected ims.core.vo.ClinicLiteVo patientclinic;
	protected ims.core.vo.LocShortMappingsVo patientlocation;
	protected ims.ocrr.vo.OcsReportToVoCollection reportto;
	protected ims.core.patient.vo.PatientRefVo patient;
	protected ims.core.vo.CareContextPasVo carecontextpas;
	protected ims.core.resource.place.vo.LocSiteRefVo orderinghospital;
	protected Boolean sendnumber;
	protected ims.core.vo.LocShortMappingsVo outpatientdept;
	protected String summaryclinicalinformation;
	protected String bleepextnumber;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
