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


public class PendingEmergencyAdmissionWorklistSearchCriteriaVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PendingEmergencyAdmissionWorklistSearchCriteriaVo()
	{
	}
	public PendingEmergencyAdmissionWorklistSearchCriteriaVo(ims.core.vo.beans.PendingEmergencyAdmissionWorklistSearchCriteriaVoBean bean)
	{
		this.type = bean.getType() == null ? null : ims.core.vo.lookups.PendingEmergencyAdmissionType.buildLookup(bean.getType());
		this.category = bean.getCategory() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getCategory());
		this.transferreason = bean.getTransferReason() == null ? null : ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest.buildLookup(bean.getTransferReason());
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo();
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo();
		this.service = bean.getService() == null ? null : bean.getService().buildVo();
		this.sourceofreferral = bean.getSourceOfReferral() == null ? null : ims.core.vo.lookups.SourceOfEmergencyReferral.buildLookup(bean.getSourceOfReferral());
		this.acceptingconsultant = bean.getAcceptingConsultant() == null ? null : bean.getAcceptingConsultant().buildVo();
		this.acceptingdatefrom = bean.getAcceptingDateFrom() == null ? null : bean.getAcceptingDateFrom().buildDate();
		this.acceptingdateto = bean.getAcceptingDateTo() == null ? null : bean.getAcceptingDateTo().buildDate();
		this.referraldatefrom = bean.getReferralDateFrom() == null ? null : bean.getReferralDateFrom().buildDate();
		this.referraldateto = bean.getReferralDateTo() == null ? null : bean.getReferralDateTo().buildDate();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.PendingEmergencyAdmissionWorklistSearchCriteriaVoBean bean)
	{
		this.type = bean.getType() == null ? null : ims.core.vo.lookups.PendingEmergencyAdmissionType.buildLookup(bean.getType());
		this.category = bean.getCategory() == null ? null : ims.core.vo.lookups.PatientStatus.buildLookup(bean.getCategory());
		this.transferreason = bean.getTransferReason() == null ? null : ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest.buildLookup(bean.getTransferReason());
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo(map);
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo(map);
		this.service = bean.getService() == null ? null : bean.getService().buildVo(map);
		this.sourceofreferral = bean.getSourceOfReferral() == null ? null : ims.core.vo.lookups.SourceOfEmergencyReferral.buildLookup(bean.getSourceOfReferral());
		this.acceptingconsultant = bean.getAcceptingConsultant() == null ? null : bean.getAcceptingConsultant().buildVo(map);
		this.acceptingdatefrom = bean.getAcceptingDateFrom() == null ? null : bean.getAcceptingDateFrom().buildDate();
		this.acceptingdateto = bean.getAcceptingDateTo() == null ? null : bean.getAcceptingDateTo().buildDate();
		this.referraldatefrom = bean.getReferralDateFrom() == null ? null : bean.getReferralDateFrom().buildDate();
		this.referraldateto = bean.getReferralDateTo() == null ? null : bean.getReferralDateTo().buildDate();
	}
	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.PendingEmergencyAdmissionWorklistSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.PendingEmergencyAdmissionWorklistSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.PendingEmergencyAdmissionWorklistSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getTypeIsNotNull()
	{
		return this.type != null;
	}
	public ims.core.vo.lookups.PendingEmergencyAdmissionType getType()
	{
		return this.type;
	}
	public void setType(ims.core.vo.lookups.PendingEmergencyAdmissionType value)
	{
		this.isValidated = false;
		this.type = value;
	}
	public boolean getCategoryIsNotNull()
	{
		return this.category != null;
	}
	public ims.core.vo.lookups.PatientStatus getCategory()
	{
		return this.category;
	}
	public void setCategory(ims.core.vo.lookups.PatientStatus value)
	{
		this.isValidated = false;
		this.category = value;
	}
	public boolean getTransferReasonIsNotNull()
	{
		return this.transferreason != null;
	}
	public ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest getTransferReason()
	{
		return this.transferreason;
	}
	public void setTransferReason(ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest value)
	{
		this.isValidated = false;
		this.transferreason = value;
	}
	public boolean getHospitalIsNotNull()
	{
		return this.hospital != null;
	}
	public ims.core.vo.LocationLiteVo getHospital()
	{
		return this.hospital;
	}
	public void setHospital(ims.core.vo.LocationLiteVo value)
	{
		this.isValidated = false;
		this.hospital = value;
	}
	public boolean getWardIsNotNull()
	{
		return this.ward != null;
	}
	public ims.core.vo.LocationLiteVo getWard()
	{
		return this.ward;
	}
	public void setWard(ims.core.vo.LocationLiteVo value)
	{
		this.isValidated = false;
		this.ward = value;
	}
	public boolean getServiceIsNotNull()
	{
		return this.service != null;
	}
	public ims.core.vo.ServiceLiteVo getService()
	{
		return this.service;
	}
	public void setService(ims.core.vo.ServiceLiteVo value)
	{
		this.isValidated = false;
		this.service = value;
	}
	public boolean getSourceOfReferralIsNotNull()
	{
		return this.sourceofreferral != null;
	}
	public ims.core.vo.lookups.SourceOfEmergencyReferral getSourceOfReferral()
	{
		return this.sourceofreferral;
	}
	public void setSourceOfReferral(ims.core.vo.lookups.SourceOfEmergencyReferral value)
	{
		this.isValidated = false;
		this.sourceofreferral = value;
	}
	public boolean getAcceptingConsultantIsNotNull()
	{
		return this.acceptingconsultant != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getAcceptingConsultant()
	{
		return this.acceptingconsultant;
	}
	public void setAcceptingConsultant(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.acceptingconsultant = value;
	}
	public boolean getAcceptingDateFromIsNotNull()
	{
		return this.acceptingdatefrom != null;
	}
	public ims.framework.utils.Date getAcceptingDateFrom()
	{
		return this.acceptingdatefrom;
	}
	public void setAcceptingDateFrom(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.acceptingdatefrom = value;
	}
	public boolean getAcceptingDateToIsNotNull()
	{
		return this.acceptingdateto != null;
	}
	public ims.framework.utils.Date getAcceptingDateTo()
	{
		return this.acceptingdateto;
	}
	public void setAcceptingDateTo(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.acceptingdateto = value;
	}
	public boolean getReferralDateFromIsNotNull()
	{
		return this.referraldatefrom != null;
	}
	public ims.framework.utils.Date getReferralDateFrom()
	{
		return this.referraldatefrom;
	}
	public void setReferralDateFrom(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.referraldatefrom = value;
	}
	public boolean getReferralDateToIsNotNull()
	{
		return this.referraldateto != null;
	}
	public ims.framework.utils.Date getReferralDateTo()
	{
		return this.referraldateto;
	}
	public void setReferralDateTo(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.referraldateto = value;
	}
	public final String getIItemText()
	{
		return toString();
	}
	public final Integer getBoId() 
	{
		return null;
	}
	public final String getBoClassName()
	{
		return null;
	}
	public boolean equals(Object obj)
	{
		if(obj == null)
			return false;
		if(!(obj instanceof PendingEmergencyAdmissionWorklistSearchCriteriaVo))
			return false;
		PendingEmergencyAdmissionWorklistSearchCriteriaVo compareObj = (PendingEmergencyAdmissionWorklistSearchCriteriaVo)obj;
		if(this.getType() == null && compareObj.getType() != null)
			return false;
		if(this.getType() != null && compareObj.getType() == null)
			return false;
		if(this.getType() != null && compareObj.getType() != null)
			return this.getType().equals(compareObj.getType());
		return super.equals(obj);
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.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]);
			}
		}
		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 Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		PendingEmergencyAdmissionWorklistSearchCriteriaVo clone = new PendingEmergencyAdmissionWorklistSearchCriteriaVo();
		
		if(this.type == null)
			clone.type = null;
		else
			clone.type = (ims.core.vo.lookups.PendingEmergencyAdmissionType)this.type.clone();
		if(this.category == null)
			clone.category = null;
		else
			clone.category = (ims.core.vo.lookups.PatientStatus)this.category.clone();
		if(this.transferreason == null)
			clone.transferreason = null;
		else
			clone.transferreason = (ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest)this.transferreason.clone();
		if(this.hospital == null)
			clone.hospital = null;
		else
			clone.hospital = (ims.core.vo.LocationLiteVo)this.hospital.clone();
		if(this.ward == null)
			clone.ward = null;
		else
			clone.ward = (ims.core.vo.LocationLiteVo)this.ward.clone();
		if(this.service == null)
			clone.service = null;
		else
			clone.service = (ims.core.vo.ServiceLiteVo)this.service.clone();
		if(this.sourceofreferral == null)
			clone.sourceofreferral = null;
		else
			clone.sourceofreferral = (ims.core.vo.lookups.SourceOfEmergencyReferral)this.sourceofreferral.clone();
		if(this.acceptingconsultant == null)
			clone.acceptingconsultant = null;
		else
			clone.acceptingconsultant = (ims.core.vo.MemberOfStaffLiteVo)this.acceptingconsultant.clone();
		if(this.acceptingdatefrom == null)
			clone.acceptingdatefrom = null;
		else
			clone.acceptingdatefrom = (ims.framework.utils.Date)this.acceptingdatefrom.clone();
		if(this.acceptingdateto == null)
			clone.acceptingdateto = null;
		else
			clone.acceptingdateto = (ims.framework.utils.Date)this.acceptingdateto.clone();
		if(this.referraldatefrom == null)
			clone.referraldatefrom = null;
		else
			clone.referraldatefrom = (ims.framework.utils.Date)this.referraldatefrom.clone();
		if(this.referraldateto == null)
			clone.referraldateto = null;
		else
			clone.referraldateto = (ims.framework.utils.Date)this.referraldateto.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 (!(PendingEmergencyAdmissionWorklistSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PendingEmergencyAdmissionWorklistSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		PendingEmergencyAdmissionWorklistSearchCriteriaVo compareObj = (PendingEmergencyAdmissionWorklistSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getType() == null && compareObj.getType() != null)
				return -1;
			if(this.getType() != null && compareObj.getType() == null)
				return 1;
			if(this.getType() != null && compareObj.getType() != null)
				retVal = this.getType().compareTo(compareObj.getType());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.type != null)
			count++;
		if(this.category != null)
			count++;
		if(this.transferreason != null)
			count++;
		if(this.hospital != null)
			count++;
		if(this.ward != null)
			count++;
		if(this.service != null)
			count++;
		if(this.sourceofreferral != null)
			count++;
		if(this.acceptingconsultant != null)
			count++;
		if(this.acceptingdatefrom != null)
			count++;
		if(this.acceptingdateto != null)
			count++;
		if(this.referraldatefrom != null)
			count++;
		if(this.referraldateto != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 12;
	}
	protected ims.core.vo.lookups.PendingEmergencyAdmissionType type;
	protected ims.core.vo.lookups.PatientStatus category;
	protected ims.core.vo.lookups.TransferReasonForPendingEmergencyAdmissionRequest transferreason;
	protected ims.core.vo.LocationLiteVo hospital;
	protected ims.core.vo.LocationLiteVo ward;
	protected ims.core.vo.ServiceLiteVo service;
	protected ims.core.vo.lookups.SourceOfEmergencyReferral sourceofreferral;
	protected ims.core.vo.MemberOfStaffLiteVo acceptingconsultant;
	protected ims.framework.utils.Date acceptingdatefrom;
	protected ims.framework.utils.Date acceptingdateto;
	protected ims.framework.utils.Date referraldatefrom;
	protected ims.framework.utils.Date referraldateto;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
