/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/clinical/vo/OutgoingReferralListSearchCriteriaVo.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 OutgoingReferralListSearchCriteriaVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public OutgoingReferralListSearchCriteriaVo()
	{
	}
	public OutgoingReferralListSearchCriteriaVo(ims.clinical.vo.beans.OutgoingReferralListSearchCriteriaVoBean bean)
	{
		this.awaitingreferralletter = bean.getAwaitingReferralLetter();
		this.awaitingsignoff = bean.getAwaitingSignOff();
		this.requiringfurtherinfo = bean.getRequiringFurtherInfo();
		this.awaitingacceptance = bean.getAwaitingAcceptance();
		this.requiressecondopinion = bean.getRequiresSecondOpinion();
		this.accepted = bean.getAccepted();
		this.requiresappt = bean.getRequiresAppt();
		this.appointmentbooked = bean.getAppointmentBooked();
		this.rejectionacknowledged = bean.getRejectionAcknowledged();
		this.rejectionnotacknowledged = bean.getRejectionNotAcknowledged();
		this.completed = bean.getCompleted();
		this.inpatient = bean.getInpatient();
		this.outpatient = bean.getOutpatient();
		this.serviceby = bean.getServiceBy() == null ? null : bean.getServiceBy().buildVo();
		this.serviceto = bean.getServiceTo() == null ? null : bean.getServiceTo().buildVo();
		this.hcpto = bean.getHcpTo() == null ? null : bean.getHcpTo().buildVo();
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.hcpby = bean.getHcpBy() == null ? null : bean.getHcpBy().buildVo();
		this.servicesbycollection = ims.clinical.vo.ServiceForIncomingReferralListVoCollection.buildFromBeanCollection(bean.getServicesByCollection());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.OutgoingReferralListSearchCriteriaVoBean bean)
	{
		this.awaitingreferralletter = bean.getAwaitingReferralLetter();
		this.awaitingsignoff = bean.getAwaitingSignOff();
		this.requiringfurtherinfo = bean.getRequiringFurtherInfo();
		this.awaitingacceptance = bean.getAwaitingAcceptance();
		this.requiressecondopinion = bean.getRequiresSecondOpinion();
		this.accepted = bean.getAccepted();
		this.requiresappt = bean.getRequiresAppt();
		this.appointmentbooked = bean.getAppointmentBooked();
		this.rejectionacknowledged = bean.getRejectionAcknowledged();
		this.rejectionnotacknowledged = bean.getRejectionNotAcknowledged();
		this.completed = bean.getCompleted();
		this.inpatient = bean.getInpatient();
		this.outpatient = bean.getOutpatient();
		this.serviceby = bean.getServiceBy() == null ? null : bean.getServiceBy().buildVo(map);
		this.serviceto = bean.getServiceTo() == null ? null : bean.getServiceTo().buildVo(map);
		this.hcpto = bean.getHcpTo() == null ? null : bean.getHcpTo().buildVo(map);
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.hcpby = bean.getHcpBy() == null ? null : bean.getHcpBy().buildVo(map);
		this.servicesbycollection = ims.clinical.vo.ServiceForIncomingReferralListVoCollection.buildFromBeanCollection(bean.getServicesByCollection());
	}
	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.OutgoingReferralListSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.OutgoingReferralListSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.OutgoingReferralListSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getAwaitingReferralLetterIsNotNull()
	{
		return this.awaitingreferralletter != null;
	}
	public Boolean getAwaitingReferralLetter()
	{
		return this.awaitingreferralletter;
	}
	public void setAwaitingReferralLetter(Boolean value)
	{
		this.isValidated = false;
		this.awaitingreferralletter = value;
	}
	public boolean getAwaitingSignOffIsNotNull()
	{
		return this.awaitingsignoff != null;
	}
	public Boolean getAwaitingSignOff()
	{
		return this.awaitingsignoff;
	}
	public void setAwaitingSignOff(Boolean value)
	{
		this.isValidated = false;
		this.awaitingsignoff = value;
	}
	public boolean getRequiringFurtherInfoIsNotNull()
	{
		return this.requiringfurtherinfo != null;
	}
	public Boolean getRequiringFurtherInfo()
	{
		return this.requiringfurtherinfo;
	}
	public void setRequiringFurtherInfo(Boolean value)
	{
		this.isValidated = false;
		this.requiringfurtherinfo = value;
	}
	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 getRequiresSecondOpinionIsNotNull()
	{
		return this.requiressecondopinion != null;
	}
	public Boolean getRequiresSecondOpinion()
	{
		return this.requiressecondopinion;
	}
	public void setRequiresSecondOpinion(Boolean value)
	{
		this.isValidated = false;
		this.requiressecondopinion = 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 boolean getRequiresApptIsNotNull()
	{
		return this.requiresappt != null;
	}
	public Boolean getRequiresAppt()
	{
		return this.requiresappt;
	}
	public void setRequiresAppt(Boolean value)
	{
		this.isValidated = false;
		this.requiresappt = 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 getRejectionAcknowledgedIsNotNull()
	{
		return this.rejectionacknowledged != null;
	}
	public Boolean getRejectionAcknowledged()
	{
		return this.rejectionacknowledged;
	}
	public void setRejectionAcknowledged(Boolean value)
	{
		this.isValidated = false;
		this.rejectionacknowledged = value;
	}
	public boolean getRejectionNotAcknowledgedIsNotNull()
	{
		return this.rejectionnotacknowledged != null;
	}
	public Boolean getRejectionNotAcknowledged()
	{
		return this.rejectionnotacknowledged;
	}
	public void setRejectionNotAcknowledged(Boolean value)
	{
		this.isValidated = false;
		this.rejectionnotacknowledged = 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 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 getServiceByIsNotNull()
	{
		return this.serviceby != null;
	}
	public ims.core.vo.ServiceLiteVo getServiceBy()
	{
		return this.serviceby;
	}
	public void setServiceBy(ims.core.vo.ServiceLiteVo value)
	{
		this.isValidated = false;
		this.serviceby = value;
	}
	public boolean getServiceToIsNotNull()
	{
		return this.serviceto != null;
	}
	public ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo getServiceTo()
	{
		return this.serviceto;
	}
	public void setServiceTo(ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo value)
	{
		this.isValidated = false;
		this.serviceto = value;
	}
	public boolean getHcpToIsNotNull()
	{
		return this.hcpto != null;
	}
	public ims.core.vo.HcpLiteVo getHcpTo()
	{
		return this.hcpto;
	}
	public void setHcpTo(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.hcpto = value;
	}
	public boolean getDateFromIsNotNull()
	{
		return this.datefrom != null;
	}
	public ims.framework.utils.Date getDateFrom()
	{
		return this.datefrom;
	}
	public void setDateFrom(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.datefrom = value;
	}
	public boolean getDateToIsNotNull()
	{
		return this.dateto != null;
	}
	public ims.framework.utils.Date getDateTo()
	{
		return this.dateto;
	}
	public void setDateTo(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dateto = value;
	}
	public boolean getHcpByIsNotNull()
	{
		return this.hcpby != null;
	}
	public ims.core.vo.HcpLiteVo getHcpBy()
	{
		return this.hcpby;
	}
	public void setHcpBy(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.hcpby = value;
	}
	public boolean getServicesByCollectionIsNotNull()
	{
		return this.servicesbycollection != null;
	}
	public ims.clinical.vo.ServiceForIncomingReferralListVoCollection getServicesByCollection()
	{
		return this.servicesbycollection;
	}
	public void setServicesByCollection(ims.clinical.vo.ServiceForIncomingReferralListVoCollection value)
	{
		this.isValidated = false;
		this.servicesbycollection = 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 OutgoingReferralListSearchCriteriaVo))
			return false;
		OutgoingReferralListSearchCriteriaVo compareObj = (OutgoingReferralListSearchCriteriaVo)obj;
		if(this.getAwaitingReferralLetter() == null && compareObj.getAwaitingReferralLetter() != null)
			return false;
		if(this.getAwaitingReferralLetter() != null && compareObj.getAwaitingReferralLetter() == null)
			return false;
		if(this.getAwaitingReferralLetter() != null && compareObj.getAwaitingReferralLetter() != null)
			return this.getAwaitingReferralLetter().equals(compareObj.getAwaitingReferralLetter());
		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;
	
		OutgoingReferralListSearchCriteriaVo clone = new OutgoingReferralListSearchCriteriaVo();
		
		clone.awaitingreferralletter = this.awaitingreferralletter;
		clone.awaitingsignoff = this.awaitingsignoff;
		clone.requiringfurtherinfo = this.requiringfurtherinfo;
		clone.awaitingacceptance = this.awaitingacceptance;
		clone.requiressecondopinion = this.requiressecondopinion;
		clone.accepted = this.accepted;
		clone.requiresappt = this.requiresappt;
		clone.appointmentbooked = this.appointmentbooked;
		clone.rejectionacknowledged = this.rejectionacknowledged;
		clone.rejectionnotacknowledged = this.rejectionnotacknowledged;
		clone.completed = this.completed;
		clone.inpatient = this.inpatient;
		clone.outpatient = this.outpatient;
		if(this.serviceby == null)
			clone.serviceby = null;
		else
			clone.serviceby = (ims.core.vo.ServiceLiteVo)this.serviceby.clone();
		if(this.serviceto == null)
			clone.serviceto = null;
		else
			clone.serviceto = (ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo)this.serviceto.clone();
		if(this.hcpto == null)
			clone.hcpto = null;
		else
			clone.hcpto = (ims.core.vo.HcpLiteVo)this.hcpto.clone();
		if(this.datefrom == null)
			clone.datefrom = null;
		else
			clone.datefrom = (ims.framework.utils.Date)this.datefrom.clone();
		if(this.dateto == null)
			clone.dateto = null;
		else
			clone.dateto = (ims.framework.utils.Date)this.dateto.clone();
		if(this.hcpby == null)
			clone.hcpby = null;
		else
			clone.hcpby = (ims.core.vo.HcpLiteVo)this.hcpby.clone();
		if(this.servicesbycollection == null)
			clone.servicesbycollection = null;
		else
			clone.servicesbycollection = (ims.clinical.vo.ServiceForIncomingReferralListVoCollection)this.servicesbycollection.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 (!(OutgoingReferralListSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A OutgoingReferralListSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		OutgoingReferralListSearchCriteriaVo compareObj = (OutgoingReferralListSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getAwaitingReferralLetter() == null && compareObj.getAwaitingReferralLetter() != null)
				return -1;
			if(this.getAwaitingReferralLetter() != null && compareObj.getAwaitingReferralLetter() == null)
				return 1;
			if(this.getAwaitingReferralLetter() != null && compareObj.getAwaitingReferralLetter() != null)
				retVal = this.getAwaitingReferralLetter().compareTo(compareObj.getAwaitingReferralLetter());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.awaitingreferralletter != null)
			count++;
		if(this.awaitingsignoff != null)
			count++;
		if(this.requiringfurtherinfo != null)
			count++;
		if(this.awaitingacceptance != null)
			count++;
		if(this.requiressecondopinion != null)
			count++;
		if(this.accepted != null)
			count++;
		if(this.requiresappt != null)
			count++;
		if(this.appointmentbooked != null)
			count++;
		if(this.rejectionacknowledged != null)
			count++;
		if(this.rejectionnotacknowledged != null)
			count++;
		if(this.completed != null)
			count++;
		if(this.inpatient != null)
			count++;
		if(this.outpatient != null)
			count++;
		if(this.serviceby != null)
			count++;
		if(this.serviceto != null)
			count++;
		if(this.hcpto != null)
			count++;
		if(this.datefrom != null)
			count++;
		if(this.dateto != null)
			count++;
		if(this.hcpby != null)
			count++;
		if(this.servicesbycollection != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 20;
	}
	protected Boolean awaitingreferralletter;
	protected Boolean awaitingsignoff;
	protected Boolean requiringfurtherinfo;
	protected Boolean awaitingacceptance;
	protected Boolean requiressecondopinion;
	protected Boolean accepted;
	protected Boolean requiresappt;
	protected Boolean appointmentbooked;
	protected Boolean rejectionacknowledged;
	protected Boolean rejectionnotacknowledged;
	protected Boolean completed;
	protected Boolean inpatient;
	protected Boolean outpatient;
	protected ims.core.vo.ServiceLiteVo serviceby;
	protected ims.clinical.vo.ServiceConfigIntReferralForIncomingListVo serviceto;
	protected ims.core.vo.HcpLiteVo hcpto;
	protected ims.framework.utils.Date datefrom;
	protected ims.framework.utils.Date dateto;
	protected ims.core.vo.HcpLiteVo hcpby;
	protected ims.clinical.vo.ServiceForIncomingReferralListVoCollection servicesbycollection;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
