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


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

	public IncomingReferralListCriteriaVo()
	{
	}
	public IncomingReferralListCriteriaVo(ims.clinical.vo.beans.IncomingReferralListCriteriaVoBean bean)
	{
		this.awaitingacceptance = bean.getAwaitingAcceptance();
		this.requires2ndopinion = bean.getRequires2ndOpinion();
		this.requiringappointment = bean.getRequiringAppointment();
		this.appointmentbooked = bean.getAppointmentBooked();
		this.rejected = bean.getRejected();
		this.completed = bean.getCompleted();
		this.referraltoservice = bean.getReferralToService() == null ? null : bean.getReferralToService().buildVo();
		this.referraltohcp = bean.getReferralToHcp() == null ? null : bean.getReferralToHcp().buildVo();
		this.referraldatefrom = bean.getReferralDateFrom() == null ? null : bean.getReferralDateFrom().buildDate();
		this.referraldateto = bean.getReferralDateTo() == null ? null : bean.getReferralDateTo().buildDate();
		this.inpatient = bean.getInpatient();
		this.outpatient = bean.getOutpatient();
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo();
		this.services = ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection.buildFromBeanCollection(bean.getServices());
		this.accepted = bean.getAccepted();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.IncomingReferralListCriteriaVoBean bean)
	{
		this.awaitingacceptance = bean.getAwaitingAcceptance();
		this.requires2ndopinion = bean.getRequires2ndOpinion();
		this.requiringappointment = bean.getRequiringAppointment();
		this.appointmentbooked = bean.getAppointmentBooked();
		this.rejected = bean.getRejected();
		this.completed = bean.getCompleted();
		this.referraltoservice = bean.getReferralToService() == null ? null : bean.getReferralToService().buildVo(map);
		this.referraltohcp = bean.getReferralToHcp() == null ? null : bean.getReferralToHcp().buildVo(map);
		this.referraldatefrom = bean.getReferralDateFrom() == null ? null : bean.getReferralDateFrom().buildDate();
		this.referraldateto = bean.getReferralDateTo() == null ? null : bean.getReferralDateTo().buildDate();
		this.inpatient = bean.getInpatient();
		this.outpatient = bean.getOutpatient();
		this.ward = bean.getWard() == null ? null : bean.getWard().buildVo(map);
		this.services = ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection.buildFromBeanCollection(bean.getServices());
		this.accepted = bean.getAccepted();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.clinical.vo.beans.IncomingReferralListCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.IncomingReferralListCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.IncomingReferralListCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getAwaitingAcceptanceIsNotNull()
	{
		return this.awaitingacceptance != null;
	}
	public Boolean getAwaitingAcceptance()
	{
		return this.awaitingacceptance;
	}
	public void setAwaitingAcceptance(Boolean value)
	{
		this.isValidated = false;
		this.awaitingacceptance = value;
	}
	public boolean getRequires2ndOpinionIsNotNull()
	{
		return this.requires2ndopinion != null;
	}
	public Boolean getRequires2ndOpinion()
	{
		return this.requires2ndopinion;
	}
	public void setRequires2ndOpinion(Boolean value)
	{
		this.isValidated = false;
		this.requires2ndopinion = value;
	}
	public boolean getRequiringAppointmentIsNotNull()
	{
		return this.requiringappointment != null;
	}
	public Boolean getRequiringAppointment()
	{
		return this.requiringappointment;
	}
	public void setRequiringAppointment(Boolean value)
	{
		this.isValidated = false;
		this.requiringappointment = value;
	}
	public boolean getAppointmentBookedIsNotNull()
	{
		return this.appointmentbooked != null;
	}
	public Boolean getAppointmentBooked()
	{
		return this.appointmentbooked;
	}
	public void setAppointmentBooked(Boolean value)
	{
		this.isValidated = false;
		this.appointmentbooked = value;
	}
	public boolean getRejectedIsNotNull()
	{
		return this.rejected != null;
	}
	public Boolean getRejected()
	{
		return this.rejected;
	}
	public void setRejected(Boolean value)
	{
		this.isValidated = false;
		this.rejected = value;
	}
	public boolean getCompletedIsNotNull()
	{
		return this.completed != null;
	}
	public Boolean getCompleted()
	{
		return this.completed;
	}
	public void setCompleted(Boolean value)
	{
		this.isValidated = false;
		this.completed = value;
	}
	public boolean getReferralToServiceIsNotNull()
	{
		return this.referraltoservice != null;
	}
	public ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo getReferralToService()
	{
		return this.referraltoservice;
	}
	public void setReferralToService(ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo value)
	{
		this.isValidated = false;
		this.referraltoservice = value;
	}
	public boolean getReferralToHcpIsNotNull()
	{
		return this.referraltohcp != null;
	}
	public ims.core.vo.HcpLiteVo getReferralToHcp()
	{
		return this.referraltohcp;
	}
	public void setReferralToHcp(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.referraltohcp = 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 boolean getInpatientIsNotNull()
	{
		return this.inpatient != null;
	}
	public Boolean getInpatient()
	{
		return this.inpatient;
	}
	public void setInpatient(Boolean value)
	{
		this.isValidated = false;
		this.inpatient = value;
	}
	public boolean getOutpatientIsNotNull()
	{
		return this.outpatient != null;
	}
	public Boolean getOutpatient()
	{
		return this.outpatient;
	}
	public void setOutpatient(Boolean value)
	{
		this.isValidated = false;
		this.outpatient = 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 getServicesIsNotNull()
	{
		return this.services != null;
	}
	public ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection getServices()
	{
		return this.services;
	}
	public void setServices(ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection value)
	{
		this.isValidated = false;
		this.services = value;
	}
	public boolean getAcceptedIsNotNull()
	{
		return this.accepted != null;
	}
	public Boolean getAccepted()
	{
		return this.accepted;
	}
	public void setAccepted(Boolean value)
	{
		this.isValidated = false;
		this.accepted = 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 IncomingReferralListCriteriaVo))
			return false;
		IncomingReferralListCriteriaVo compareObj = (IncomingReferralListCriteriaVo)obj;
		if(this.getAwaitingAcceptance() == null && compareObj.getAwaitingAcceptance() != null)
			return false;
		if(this.getAwaitingAcceptance() != null && compareObj.getAwaitingAcceptance() == null)
			return false;
		if(this.getAwaitingAcceptance() != null && compareObj.getAwaitingAcceptance() != null)
			if(!this.getAwaitingAcceptance().equals(compareObj.getAwaitingAcceptance()))
				return false;
		if(this.getRequires2ndOpinion() == null && compareObj.getRequires2ndOpinion() != null)
			return false;
		if(this.getRequires2ndOpinion() != null && compareObj.getRequires2ndOpinion() == null)
			return false;
		if(this.getRequires2ndOpinion() != null && compareObj.getRequires2ndOpinion() != null)
			if(!this.getRequires2ndOpinion().equals(compareObj.getRequires2ndOpinion()))
				return false;
		if(this.getRequiringAppointment() == null && compareObj.getRequiringAppointment() != null)
			return false;
		if(this.getRequiringAppointment() != null && compareObj.getRequiringAppointment() == null)
			return false;
		if(this.getRequiringAppointment() != null && compareObj.getRequiringAppointment() != null)
			if(!this.getRequiringAppointment().equals(compareObj.getRequiringAppointment()))
				return false;
		if(this.getAppointmentBooked() == null && compareObj.getAppointmentBooked() != null)
			return false;
		if(this.getAppointmentBooked() != null && compareObj.getAppointmentBooked() == null)
			return false;
		if(this.getAppointmentBooked() != null && compareObj.getAppointmentBooked() != null)
			if(!this.getAppointmentBooked().equals(compareObj.getAppointmentBooked()))
				return false;
		if(this.getRejected() == null && compareObj.getRejected() != null)
			return false;
		if(this.getRejected() != null && compareObj.getRejected() == null)
			return false;
		if(this.getRejected() != null && compareObj.getRejected() != null)
			if(!this.getRejected().equals(compareObj.getRejected()))
				return false;
		if(this.getCompleted() == null && compareObj.getCompleted() != null)
			return false;
		if(this.getCompleted() != null && compareObj.getCompleted() == null)
			return false;
		if(this.getCompleted() != null && compareObj.getCompleted() != null)
			if(!this.getCompleted().equals(compareObj.getCompleted()))
				return false;
		if(this.getReferralToService() == null && compareObj.getReferralToService() != null)
			return false;
		if(this.getReferralToService() != null && compareObj.getReferralToService() == null)
			return false;
		if(this.getReferralToService() != null && compareObj.getReferralToService() != null)
			if(!this.getReferralToService().equals(compareObj.getReferralToService()))
				return false;
		if(this.getReferralToHcp() == null && compareObj.getReferralToHcp() != null)
			return false;
		if(this.getReferralToHcp() != null && compareObj.getReferralToHcp() == null)
			return false;
		if(this.getReferralToHcp() != null && compareObj.getReferralToHcp() != null)
			if(!this.getReferralToHcp().equals(compareObj.getReferralToHcp()))
				return false;
		if(this.getReferralDateFrom() == null && compareObj.getReferralDateFrom() != null)
			return false;
		if(this.getReferralDateFrom() != null && compareObj.getReferralDateFrom() == null)
			return false;
		if(this.getReferralDateFrom() != null && compareObj.getReferralDateFrom() != null)
			if(!this.getReferralDateFrom().equals(compareObj.getReferralDateFrom()))
				return false;
		if(this.getReferralDateTo() == null && compareObj.getReferralDateTo() != null)
			return false;
		if(this.getReferralDateTo() != null && compareObj.getReferralDateTo() == null)
			return false;
		if(this.getReferralDateTo() != null && compareObj.getReferralDateTo() != null)
			if(!this.getReferralDateTo().equals(compareObj.getReferralDateTo()))
				return false;
		if(this.getInpatient() == null && compareObj.getInpatient() != null)
			return false;
		if(this.getInpatient() != null && compareObj.getInpatient() == null)
			return false;
		if(this.getInpatient() != null && compareObj.getInpatient() != null)
			if(!this.getInpatient().equals(compareObj.getInpatient()))
				return false;
		if(this.getOutpatient() == null && compareObj.getOutpatient() != null)
			return false;
		if(this.getOutpatient() != null && compareObj.getOutpatient() == null)
			return false;
		if(this.getOutpatient() != null && compareObj.getOutpatient() != null)
			if(!this.getOutpatient().equals(compareObj.getOutpatient()))
				return false;
		if(this.getWard() == null && compareObj.getWard() != null)
			return false;
		if(this.getWard() != null && compareObj.getWard() == null)
			return false;
		if(this.getWard() != null && compareObj.getWard() != null)
			return this.getWard().equals(compareObj.getWard());
		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;
	
		IncomingReferralListCriteriaVo clone = new IncomingReferralListCriteriaVo();
		
		clone.awaitingacceptance = this.awaitingacceptance;
		clone.requires2ndopinion = this.requires2ndopinion;
		clone.requiringappointment = this.requiringappointment;
		clone.appointmentbooked = this.appointmentbooked;
		clone.rejected = this.rejected;
		clone.completed = this.completed;
		if(this.referraltoservice == null)
			clone.referraltoservice = null;
		else
			clone.referraltoservice = (ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo)this.referraltoservice.clone();
		if(this.referraltohcp == null)
			clone.referraltohcp = null;
		else
			clone.referraltohcp = (ims.core.vo.HcpLiteVo)this.referraltohcp.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.inpatient = this.inpatient;
		clone.outpatient = this.outpatient;
		if(this.ward == null)
			clone.ward = null;
		else
			clone.ward = (ims.core.vo.LocationLiteVo)this.ward.clone();
		if(this.services == null)
			clone.services = null;
		else
			clone.services = (ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection)this.services.clone();
		clone.accepted = this.accepted;
		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 (!(IncomingReferralListCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A IncomingReferralListCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		IncomingReferralListCriteriaVo compareObj = (IncomingReferralListCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getAwaitingAcceptance() == null && compareObj.getAwaitingAcceptance() != null)
				return -1;
			if(this.getAwaitingAcceptance() != null && compareObj.getAwaitingAcceptance() == null)
				return 1;
			if(this.getAwaitingAcceptance() != null && compareObj.getAwaitingAcceptance() != null)
				retVal = this.getAwaitingAcceptance().compareTo(compareObj.getAwaitingAcceptance());
		}
		if (retVal == 0)
		{
			if(this.getRequires2ndOpinion() == null && compareObj.getRequires2ndOpinion() != null)
				return -1;
			if(this.getRequires2ndOpinion() != null && compareObj.getRequires2ndOpinion() == null)
				return 1;
			if(this.getRequires2ndOpinion() != null && compareObj.getRequires2ndOpinion() != null)
				retVal = this.getRequires2ndOpinion().compareTo(compareObj.getRequires2ndOpinion());
		}
		if (retVal == 0)
		{
			if(this.getRequiringAppointment() == null && compareObj.getRequiringAppointment() != null)
				return -1;
			if(this.getRequiringAppointment() != null && compareObj.getRequiringAppointment() == null)
				return 1;
			if(this.getRequiringAppointment() != null && compareObj.getRequiringAppointment() != null)
				retVal = this.getRequiringAppointment().compareTo(compareObj.getRequiringAppointment());
		}
		if (retVal == 0)
		{
			if(this.getAppointmentBooked() == null && compareObj.getAppointmentBooked() != null)
				return -1;
			if(this.getAppointmentBooked() != null && compareObj.getAppointmentBooked() == null)
				return 1;
			if(this.getAppointmentBooked() != null && compareObj.getAppointmentBooked() != null)
				retVal = this.getAppointmentBooked().compareTo(compareObj.getAppointmentBooked());
		}
		if (retVal == 0)
		{
			if(this.getRejected() == null && compareObj.getRejected() != null)
				return -1;
			if(this.getRejected() != null && compareObj.getRejected() == null)
				return 1;
			if(this.getRejected() != null && compareObj.getRejected() != null)
				retVal = this.getRejected().compareTo(compareObj.getRejected());
		}
		if (retVal == 0)
		{
			if(this.getCompleted() == null && compareObj.getCompleted() != null)
				return -1;
			if(this.getCompleted() != null && compareObj.getCompleted() == null)
				return 1;
			if(this.getCompleted() != null && compareObj.getCompleted() != null)
				retVal = this.getCompleted().compareTo(compareObj.getCompleted());
		}
		if (retVal == 0)
		{
			if(this.getReferralToService() == null && compareObj.getReferralToService() != null)
				return -1;
			if(this.getReferralToService() != null && compareObj.getReferralToService() == null)
				return 1;
			if(this.getReferralToService() != null && compareObj.getReferralToService() != null)
				retVal = this.getReferralToService().compareTo(compareObj.getReferralToService());
		}
		if (retVal == 0)
		{
			if(this.getReferralToHcp() == null && compareObj.getReferralToHcp() != null)
				return -1;
			if(this.getReferralToHcp() != null && compareObj.getReferralToHcp() == null)
				return 1;
			if(this.getReferralToHcp() != null && compareObj.getReferralToHcp() != null)
				retVal = this.getReferralToHcp().compareTo(compareObj.getReferralToHcp());
		}
		if (retVal == 0)
		{
			if(this.getReferralDateFrom() == null && compareObj.getReferralDateFrom() != null)
				return -1;
			if(this.getReferralDateFrom() != null && compareObj.getReferralDateFrom() == null)
				return 1;
			if(this.getReferralDateFrom() != null && compareObj.getReferralDateFrom() != null)
				retVal = this.getReferralDateFrom().compareTo(compareObj.getReferralDateFrom());
		}
		if (retVal == 0)
		{
			if(this.getReferralDateTo() == null && compareObj.getReferralDateTo() != null)
				return -1;
			if(this.getReferralDateTo() != null && compareObj.getReferralDateTo() == null)
				return 1;
			if(this.getReferralDateTo() != null && compareObj.getReferralDateTo() != null)
				retVal = this.getReferralDateTo().compareTo(compareObj.getReferralDateTo());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.awaitingacceptance != null)
			count++;
		if(this.requires2ndopinion != null)
			count++;
		if(this.requiringappointment != null)
			count++;
		if(this.appointmentbooked != null)
			count++;
		if(this.rejected != null)
			count++;
		if(this.completed != null)
			count++;
		if(this.referraltoservice != null)
			count++;
		if(this.referraltohcp != null)
			count++;
		if(this.referraldatefrom != null)
			count++;
		if(this.referraldateto != null)
			count++;
		if(this.inpatient != null)
			count++;
		if(this.outpatient != null)
			count++;
		if(this.ward != null)
			count++;
		if(this.services != null)
			count++;
		if(this.accepted != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 15;
	}
	protected Boolean awaitingacceptance;
	protected Boolean requires2ndopinion;
	protected Boolean requiringappointment;
	protected Boolean appointmentbooked;
	protected Boolean rejected;
	protected Boolean completed;
	protected ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo referraltoservice;
	protected ims.core.vo.HcpLiteVo referraltohcp;
	protected ims.framework.utils.Date referraldatefrom;
	protected ims.framework.utils.Date referraldateto;
	protected Boolean inpatient;
	protected Boolean outpatient;
	protected ims.core.vo.LocationLiteVo ward;
	protected ims.clinical.vo.ServiceConfigIntReferralForIncomingListVoCollection services;
	protected Boolean accepted;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
