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

	public OutpatientClinicListSearchCriteriaVo()
	{
	}
	public OutpatientClinicListSearchCriteriaVo(ims.clinical.vo.beans.OutpatientClinicListSearchCriteriaVoBean bean)
	{
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo();
		this.clinic = bean.getClinic() == null ? null : bean.getClinic().buildVo();
		this.date = bean.getDate() == null ? null : bean.getDate().buildDate();
		this.service = bean.getService() == null ? null : bean.getService().buildVo();
		this.listowners = ims.core.vo.HcpLiteVoCollection.buildFromBeanCollection(bean.getListOwners());
		this.listtype = ims.scheduling.vo.lookups.ProfileListTypeCollection.buildFromBeanCollection(bean.getListType());
		this.outpatientlocation = bean.getOutPatientLocation() == null ? null : bean.getOutPatientLocation().buildVo();
		this.wastimeron = bean.getWasTimerOn();
		this.timefrom = bean.getTimeFrom() == null ? null : bean.getTimeFrom().buildTime();
		this.timeto = bean.getTimeTo() == null ? null : bean.getTimeTo().buildTime();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.OutpatientClinicListSearchCriteriaVoBean bean)
	{
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo(map);
		this.clinic = bean.getClinic() == null ? null : bean.getClinic().buildVo(map);
		this.date = bean.getDate() == null ? null : bean.getDate().buildDate();
		this.service = bean.getService() == null ? null : bean.getService().buildVo(map);
		this.listowners = ims.core.vo.HcpLiteVoCollection.buildFromBeanCollection(bean.getListOwners());
		this.listtype = ims.scheduling.vo.lookups.ProfileListTypeCollection.buildFromBeanCollection(bean.getListType());
		this.outpatientlocation = bean.getOutPatientLocation() == null ? null : bean.getOutPatientLocation().buildVo(map);
		this.wastimeron = bean.getWasTimerOn();
		this.timefrom = bean.getTimeFrom() == null ? null : bean.getTimeFrom().buildTime();
		this.timeto = bean.getTimeTo() == null ? null : bean.getTimeTo().buildTime();
	}
	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.OutpatientClinicListSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.OutpatientClinicListSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.OutpatientClinicListSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	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 getClinicIsNotNull()
	{
		return this.clinic != null;
	}
	public ims.scheduling.vo.SessionShortVo getClinic()
	{
		return this.clinic;
	}
	public void setClinic(ims.scheduling.vo.SessionShortVo value)
	{
		this.isValidated = false;
		this.clinic = value;
	}
	public boolean getDateIsNotNull()
	{
		return this.date != null;
	}
	public ims.framework.utils.Date getDate()
	{
		return this.date;
	}
	public void setDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.date = 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 getListOwnersIsNotNull()
	{
		return this.listowners != null;
	}
	public ims.core.vo.HcpLiteVoCollection getListOwners()
	{
		return this.listowners;
	}
	public void setListOwners(ims.core.vo.HcpLiteVoCollection value)
	{
		this.isValidated = false;
		this.listowners = value;
	}
	public boolean getListTypeIsNotNull()
	{
		return this.listtype != null;
	}
	public ims.scheduling.vo.lookups.ProfileListTypeCollection getListType()
	{
		return this.listtype;
	}
	public void setListType(ims.scheduling.vo.lookups.ProfileListTypeCollection value)
	{
		this.isValidated = false;
		this.listtype = value;
	}
	public boolean getOutPatientLocationIsNotNull()
	{
		return this.outpatientlocation != null;
	}
	public ims.core.vo.LocationLiteVo getOutPatientLocation()
	{
		return this.outpatientlocation;
	}
	public void setOutPatientLocation(ims.core.vo.LocationLiteVo value)
	{
		this.isValidated = false;
		this.outpatientlocation = value;
	}
	public boolean getWasTimerOnIsNotNull()
	{
		return this.wastimeron != null;
	}
	public Boolean getWasTimerOn()
	{
		return this.wastimeron;
	}
	public void setWasTimerOn(Boolean value)
	{
		this.isValidated = false;
		this.wastimeron = value;
	}
	public boolean getTimeFromIsNotNull()
	{
		return this.timefrom != null;
	}
	public ims.framework.utils.Time getTimeFrom()
	{
		return this.timefrom;
	}
	public void setTimeFrom(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.timefrom = value;
	}
	public boolean getTimeToIsNotNull()
	{
		return this.timeto != null;
	}
	public ims.framework.utils.Time getTimeTo()
	{
		return this.timeto;
	}
	public void setTimeTo(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.timeto = 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 OutpatientClinicListSearchCriteriaVo))
			return false;
		OutpatientClinicListSearchCriteriaVo compareObj = (OutpatientClinicListSearchCriteriaVo)obj;
		if(this.getHospital() == null && compareObj.getHospital() != null)
			return false;
		if(this.getHospital() != null && compareObj.getHospital() == null)
			return false;
		if(this.getHospital() != null && compareObj.getHospital() != null)
			if(!this.getHospital().equals(compareObj.getHospital()))
				return false;
		if(this.getClinic() == null && compareObj.getClinic() != null)
			return false;
		if(this.getClinic() != null && compareObj.getClinic() == null)
			return false;
		if(this.getClinic() != null && compareObj.getClinic() != null)
			if(!this.getClinic().equals(compareObj.getClinic()))
				return false;
		if(this.getDate() == null && compareObj.getDate() != null)
			return false;
		if(this.getDate() != null && compareObj.getDate() == null)
			return false;
		if(this.getDate() != null && compareObj.getDate() != null)
			if(!this.getDate().equals(compareObj.getDate()))
				return false;
		if(this.getService() == null && compareObj.getService() != null)
			return false;
		if(this.getService() != null && compareObj.getService() == null)
			return false;
		if(this.getService() != null && compareObj.getService() != null)
			if(!this.getService().equals(compareObj.getService()))
				return false;
		if(this.getListOwners() == null && compareObj.getListOwners() != null)
			return false;
		if(this.getListOwners() != null && compareObj.getListOwners() == null)
			return false;
		if(this.getListOwners() != null && compareObj.getListOwners() != null)
			if(!this.getListOwners().equals(compareObj.getListOwners()))
				return false;
		if(this.getListType() == null && compareObj.getListType() != null)
			return false;
		if(this.getListType() != null && compareObj.getListType() == null)
			return false;
		if(this.getListType() != null && compareObj.getListType() != null)
			if(!this.getListType().equals(compareObj.getListType()))
				return false;
		if(this.getOutPatientLocation() == null && compareObj.getOutPatientLocation() != null)
			return false;
		if(this.getOutPatientLocation() != null && compareObj.getOutPatientLocation() == null)
			return false;
		if(this.getOutPatientLocation() != null && compareObj.getOutPatientLocation() != null)
			if(!this.getOutPatientLocation().equals(compareObj.getOutPatientLocation()))
				return false;
		if(this.getWasTimerOn() == null && compareObj.getWasTimerOn() != null)
			return false;
		if(this.getWasTimerOn() != null && compareObj.getWasTimerOn() == null)
			return false;
		if(this.getWasTimerOn() != null && compareObj.getWasTimerOn() != null)
			return this.getWasTimerOn().equals(compareObj.getWasTimerOn());
		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;
	
		OutpatientClinicListSearchCriteriaVo clone = new OutpatientClinicListSearchCriteriaVo();
		
		if(this.hospital == null)
			clone.hospital = null;
		else
			clone.hospital = (ims.core.vo.LocationLiteVo)this.hospital.clone();
		if(this.clinic == null)
			clone.clinic = null;
		else
			clone.clinic = (ims.scheduling.vo.SessionShortVo)this.clinic.clone();
		if(this.date == null)
			clone.date = null;
		else
			clone.date = (ims.framework.utils.Date)this.date.clone();
		if(this.service == null)
			clone.service = null;
		else
			clone.service = (ims.core.vo.ServiceLiteVo)this.service.clone();
		if(this.listowners == null)
			clone.listowners = null;
		else
			clone.listowners = (ims.core.vo.HcpLiteVoCollection)this.listowners.clone();
		if(this.listtype == null)
			clone.listtype = null;
		else
			clone.listtype = (ims.scheduling.vo.lookups.ProfileListTypeCollection)this.listtype.clone();
		if(this.outpatientlocation == null)
			clone.outpatientlocation = null;
		else
			clone.outpatientlocation = (ims.core.vo.LocationLiteVo)this.outpatientlocation.clone();
		clone.wastimeron = this.wastimeron;
		if(this.timefrom == null)
			clone.timefrom = null;
		else
			clone.timefrom = (ims.framework.utils.Time)this.timefrom.clone();
		if(this.timeto == null)
			clone.timeto = null;
		else
			clone.timeto = (ims.framework.utils.Time)this.timeto.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 (!(OutpatientClinicListSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A OutpatientClinicListSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		OutpatientClinicListSearchCriteriaVo compareObj = (OutpatientClinicListSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getHospital() == null && compareObj.getHospital() != null)
				return -1;
			if(this.getHospital() != null && compareObj.getHospital() == null)
				return 1;
			if(this.getHospital() != null && compareObj.getHospital() != null)
				retVal = this.getHospital().compareTo(compareObj.getHospital());
		}
		if (retVal == 0)
		{
			if(this.getClinic() == null && compareObj.getClinic() != null)
				return -1;
			if(this.getClinic() != null && compareObj.getClinic() == null)
				return 1;
			if(this.getClinic() != null && compareObj.getClinic() != null)
				retVal = this.getClinic().compareTo(compareObj.getClinic());
		}
		if (retVal == 0)
		{
			if(this.getDate() == null && compareObj.getDate() != null)
				return -1;
			if(this.getDate() != null && compareObj.getDate() == null)
				return 1;
			if(this.getDate() != null && compareObj.getDate() != null)
				retVal = this.getDate().compareTo(compareObj.getDate());
		}
		if (retVal == 0)
		{
			if(this.getService() == null && compareObj.getService() != null)
				return -1;
			if(this.getService() != null && compareObj.getService() == null)
				return 1;
			if(this.getService() != null && compareObj.getService() != null)
				retVal = this.getService().compareTo(compareObj.getService());
		}
		if (retVal == 0)
		{
			if(this.getListOwners() == null && compareObj.getListOwners() != null)
				return -1;
			if(this.getListOwners() != null && compareObj.getListOwners() == null)
				return 1;
			if(this.getListOwners() != null && compareObj.getListOwners() != null)
				retVal = this.getListOwners().compareTo(compareObj.getListOwners());
		}
		if (retVal == 0)
		{
			if(this.getOutPatientLocation() == null && compareObj.getOutPatientLocation() != null)
				return -1;
			if(this.getOutPatientLocation() != null && compareObj.getOutPatientLocation() == null)
				return 1;
			if(this.getOutPatientLocation() != null && compareObj.getOutPatientLocation() != null)
				retVal = this.getOutPatientLocation().compareTo(compareObj.getOutPatientLocation());
		}
		if (retVal == 0)
		{
			if(this.getWasTimerOn() == null && compareObj.getWasTimerOn() != null)
				return -1;
			if(this.getWasTimerOn() != null && compareObj.getWasTimerOn() == null)
				return 1;
			if(this.getWasTimerOn() != null && compareObj.getWasTimerOn() != null)
				retVal = this.getWasTimerOn().compareTo(compareObj.getWasTimerOn());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.hospital != null)
			count++;
		if(this.clinic != null)
			count++;
		if(this.date != null)
			count++;
		if(this.service != null)
			count++;
		if(this.listowners != null)
			count++;
		if(this.listtype != null)
			count++;
		if(this.outpatientlocation != null)
			count++;
		if(this.wastimeron != null)
			count++;
		if(this.timefrom != null)
			count++;
		if(this.timeto != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 10;
	}
	protected ims.core.vo.LocationLiteVo hospital;
	protected ims.scheduling.vo.SessionShortVo clinic;
	protected ims.framework.utils.Date date;
	protected ims.core.vo.ServiceLiteVo service;
	protected ims.core.vo.HcpLiteVoCollection listowners;
	protected ims.scheduling.vo.lookups.ProfileListTypeCollection listtype;
	protected ims.core.vo.LocationLiteVo outpatientlocation;
	protected Boolean wastimeron;
	protected ims.framework.utils.Time timefrom;
	protected ims.framework.utils.Time timeto;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
