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


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

	public ElectiveListConfigSearchCriteriaVo()
	{
	}
	public ElectiveListConfigSearchCriteriaVo(ims.admin.vo.beans.ElectiveListConfigSearchCriteriaVoBean bean)
	{
		this.waitinglistname = bean.getWaitingListName();
		this.service = bean.getService() == null ? null : bean.getService().buildVo();
		this.consultant = bean.getConsultant() == null ? null : bean.getConsultant().buildVo();
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo();
		this.active = bean.getActive();
		this.fromdate = bean.getFromDate() == null ? null : bean.getFromDate().buildDate();
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.admin.vo.beans.ElectiveListConfigSearchCriteriaVoBean bean)
	{
		this.waitinglistname = bean.getWaitingListName();
		this.service = bean.getService() == null ? null : bean.getService().buildVo(map);
		this.consultant = bean.getConsultant() == null ? null : bean.getConsultant().buildVo(map);
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo(map);
		this.active = bean.getActive();
		this.fromdate = bean.getFromDate() == null ? null : bean.getFromDate().buildDate();
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.admin.vo.beans.ElectiveListConfigSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.admin.vo.beans.ElectiveListConfigSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.admin.vo.beans.ElectiveListConfigSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getWaitingListNameIsNotNull()
	{
		return this.waitinglistname != null;
	}
	public String getWaitingListName()
	{
		return this.waitinglistname;
	}
	public static int getWaitingListNameMaxLength()
	{
		return 255;
	}
	public void setWaitingListName(String value)
	{
		this.isValidated = false;
		this.waitinglistname = value;
	}
	public boolean getServiceIsNotNull()
	{
		return this.service != null;
	}
	public ims.admin.vo.ServiceForElectiveListConfigVo getService()
	{
		return this.service;
	}
	public void setService(ims.admin.vo.ServiceForElectiveListConfigVo value)
	{
		this.isValidated = false;
		this.service = value;
	}
	public boolean getConsultantIsNotNull()
	{
		return this.consultant != null;
	}
	public ims.core.vo.HcpLiteVo getConsultant()
	{
		return this.consultant;
	}
	public void setConsultant(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.consultant = value;
	}
	public boolean getHospitalIsNotNull()
	{
		return this.hospital != null;
	}
	public ims.core.vo.LocSiteLiteVo getHospital()
	{
		return this.hospital;
	}
	public void setHospital(ims.core.vo.LocSiteLiteVo value)
	{
		this.isValidated = false;
		this.hospital = value;
	}
	public boolean getActiveIsNotNull()
	{
		return this.active != null;
	}
	public Boolean getActive()
	{
		return this.active;
	}
	public void setActive(Boolean value)
	{
		this.isValidated = false;
		this.active = value;
	}
	public boolean getFromDateIsNotNull()
	{
		return this.fromdate != null;
	}
	public ims.framework.utils.Date getFromDate()
	{
		return this.fromdate;
	}
	public void setFromDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.fromdate = value;
	}
	public boolean getToDateIsNotNull()
	{
		return this.todate != null;
	}
	public ims.framework.utils.Date getToDate()
	{
		return this.todate;
	}
	public void setToDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.todate = 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 ElectiveListConfigSearchCriteriaVo))
			return false;
		ElectiveListConfigSearchCriteriaVo compareObj = (ElectiveListConfigSearchCriteriaVo)obj;
		if(this.getWaitingListName() == null && compareObj.getWaitingListName() != null)
			return false;
		if(this.getWaitingListName() != null && compareObj.getWaitingListName() == null)
			return false;
		if(this.getWaitingListName() != null && compareObj.getWaitingListName() != null)
			return this.getWaitingListName().equals(compareObj.getWaitingListName());
		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;
	
		ElectiveListConfigSearchCriteriaVo clone = new ElectiveListConfigSearchCriteriaVo();
		
		clone.waitinglistname = this.waitinglistname;
		if(this.service == null)
			clone.service = null;
		else
			clone.service = (ims.admin.vo.ServiceForElectiveListConfigVo)this.service.clone();
		if(this.consultant == null)
			clone.consultant = null;
		else
			clone.consultant = (ims.core.vo.HcpLiteVo)this.consultant.clone();
		if(this.hospital == null)
			clone.hospital = null;
		else
			clone.hospital = (ims.core.vo.LocSiteLiteVo)this.hospital.clone();
		clone.active = this.active;
		if(this.fromdate == null)
			clone.fromdate = null;
		else
			clone.fromdate = (ims.framework.utils.Date)this.fromdate.clone();
		if(this.todate == null)
			clone.todate = null;
		else
			clone.todate = (ims.framework.utils.Date)this.todate.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 (!(ElectiveListConfigSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ElectiveListConfigSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ElectiveListConfigSearchCriteriaVo compareObj = (ElectiveListConfigSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getWaitingListName() == null && compareObj.getWaitingListName() != null)
				return -1;
			if(this.getWaitingListName() != null && compareObj.getWaitingListName() == null)
				return 1;
			if(this.getWaitingListName() != null && compareObj.getWaitingListName() != null)
			{
				if(caseInsensitive)
					retVal = this.getWaitingListName().toLowerCase().compareTo(compareObj.getWaitingListName().toLowerCase());
				else
					retVal = this.getWaitingListName().compareTo(compareObj.getWaitingListName());
			}
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.waitinglistname != null)
			count++;
		if(this.service != null)
			count++;
		if(this.consultant != null)
			count++;
		if(this.hospital != null)
			count++;
		if(this.active != null)
			count++;
		if(this.fromdate != null)
			count++;
		if(this.todate != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 7;
	}
	protected String waitinglistname;
	protected ims.admin.vo.ServiceForElectiveListConfigVo service;
	protected ims.core.vo.HcpLiteVo consultant;
	protected ims.core.vo.LocSiteLiteVo hospital;
	protected Boolean active;
	protected ims.framework.utils.Date fromdate;
	protected ims.framework.utils.Date todate;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
