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

	public ClericalTaskWorklistSearchVo()
	{
	}
	public ClericalTaskWorklistSearchVo(ims.core.vo.beans.ClericalTaskWorklistSearchVoBean bean)
	{
		this.surname = bean.getSurname();
		this.forename = bean.getForename();
		this.hospitalno = bean.getHospitalNo();
		this.requestor = bean.getRequestor() == null ? null : bean.getRequestor().buildVo();
		this.allocatedto = bean.getAllocatedTo() == null ? null : bean.getAllocatedTo().buildVo();
		this.status = bean.getStatus() == null ? null : ims.ocrr.vo.lookups.PatientClericalTaskStatus.buildLookup(bean.getStatus());
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.ClericalTaskWorklistSearchVoBean bean)
	{
		this.surname = bean.getSurname();
		this.forename = bean.getForename();
		this.hospitalno = bean.getHospitalNo();
		this.requestor = bean.getRequestor() == null ? null : bean.getRequestor().buildVo(map);
		this.allocatedto = bean.getAllocatedTo() == null ? null : bean.getAllocatedTo().buildVo(map);
		this.status = bean.getStatus() == null ? null : ims.ocrr.vo.lookups.PatientClericalTaskStatus.buildLookup(bean.getStatus());
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().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.ClericalTaskWorklistSearchVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.ClericalTaskWorklistSearchVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.ClericalTaskWorklistSearchVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getSurnameIsNotNull()
	{
		return this.surname != null;
	}
	public String getSurname()
	{
		return this.surname;
	}
	public static int getSurnameMaxLength()
	{
		return 255;
	}
	public void setSurname(String value)
	{
		this.isValidated = false;
		this.surname = value;
	}
	public boolean getForenameIsNotNull()
	{
		return this.forename != null;
	}
	public String getForename()
	{
		return this.forename;
	}
	public static int getForenameMaxLength()
	{
		return 255;
	}
	public void setForename(String value)
	{
		this.isValidated = false;
		this.forename = value;
	}
	public boolean getHospitalNoIsNotNull()
	{
		return this.hospitalno != null;
	}
	public String getHospitalNo()
	{
		return this.hospitalno;
	}
	public static int getHospitalNoMaxLength()
	{
		return 255;
	}
	public void setHospitalNo(String value)
	{
		this.isValidated = false;
		this.hospitalno = value;
	}
	public boolean getRequestorIsNotNull()
	{
		return this.requestor != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getRequestor()
	{
		return this.requestor;
	}
	public void setRequestor(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.requestor = value;
	}
	public boolean getAllocatedToIsNotNull()
	{
		return this.allocatedto != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getAllocatedTo()
	{
		return this.allocatedto;
	}
	public void setAllocatedTo(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.allocatedto = value;
	}
	public boolean getStatusIsNotNull()
	{
		return this.status != null;
	}
	public ims.ocrr.vo.lookups.PatientClericalTaskStatus getStatus()
	{
		return this.status;
	}
	public void setStatus(ims.ocrr.vo.lookups.PatientClericalTaskStatus value)
	{
		this.isValidated = false;
		this.status = 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 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 ClericalTaskWorklistSearchVo))
			return false;
		ClericalTaskWorklistSearchVo compareObj = (ClericalTaskWorklistSearchVo)obj;
		if(this.getSurname() == null && compareObj.getSurname() != null)
			return false;
		if(this.getSurname() != null && compareObj.getSurname() == null)
			return false;
		if(this.getSurname() != null && compareObj.getSurname() != null)
			if(!this.getSurname().equals(compareObj.getSurname()))
				return false;
		if(this.getForename() == null && compareObj.getForename() != null)
			return false;
		if(this.getForename() != null && compareObj.getForename() == null)
			return false;
		if(this.getForename() != null && compareObj.getForename() != null)
			if(!this.getForename().equals(compareObj.getForename()))
				return false;
		if(this.getHospitalNo() == null && compareObj.getHospitalNo() != null)
			return false;
		if(this.getHospitalNo() != null && compareObj.getHospitalNo() == null)
			return false;
		if(this.getHospitalNo() != null && compareObj.getHospitalNo() != null)
			if(!this.getHospitalNo().equals(compareObj.getHospitalNo()))
				return false;
		if(this.getRequestor() == null && compareObj.getRequestor() != null)
			return false;
		if(this.getRequestor() != null && compareObj.getRequestor() == null)
			return false;
		if(this.getRequestor() != null && compareObj.getRequestor() != null)
			if(!this.getRequestor().equals(compareObj.getRequestor()))
				return false;
		if(this.getAllocatedTo() == null && compareObj.getAllocatedTo() != null)
			return false;
		if(this.getAllocatedTo() != null && compareObj.getAllocatedTo() == null)
			return false;
		if(this.getAllocatedTo() != null && compareObj.getAllocatedTo() != null)
			if(!this.getAllocatedTo().equals(compareObj.getAllocatedTo()))
				return false;
		if(this.getStatus() == null && compareObj.getStatus() != null)
			return false;
		if(this.getStatus() != null && compareObj.getStatus() == null)
			return false;
		if(this.getStatus() != null && compareObj.getStatus() != null)
			if(!this.getStatus().equals(compareObj.getStatus()))
				return false;
		if(this.getDateFrom() == null && compareObj.getDateFrom() != null)
			return false;
		if(this.getDateFrom() != null && compareObj.getDateFrom() == null)
			return false;
		if(this.getDateFrom() != null && compareObj.getDateFrom() != null)
			if(!this.getDateFrom().equals(compareObj.getDateFrom()))
				return false;
		if(this.getDateTo() == null && compareObj.getDateTo() != null)
			return false;
		if(this.getDateTo() != null && compareObj.getDateTo() == null)
			return false;
		if(this.getDateTo() != null && compareObj.getDateTo() != null)
			return this.getDateTo().equals(compareObj.getDateTo());
		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;
	
		ClericalTaskWorklistSearchVo clone = new ClericalTaskWorklistSearchVo();
		
		clone.surname = this.surname;
		clone.forename = this.forename;
		clone.hospitalno = this.hospitalno;
		if(this.requestor == null)
			clone.requestor = null;
		else
			clone.requestor = (ims.core.vo.MemberOfStaffLiteVo)this.requestor.clone();
		if(this.allocatedto == null)
			clone.allocatedto = null;
		else
			clone.allocatedto = (ims.core.vo.MemberOfStaffLiteVo)this.allocatedto.clone();
		if(this.status == null)
			clone.status = null;
		else
			clone.status = (ims.ocrr.vo.lookups.PatientClericalTaskStatus)this.status.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();
		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 (!(ClericalTaskWorklistSearchVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ClericalTaskWorklistSearchVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ClericalTaskWorklistSearchVo compareObj = (ClericalTaskWorklistSearchVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getSurname() == null && compareObj.getSurname() != null)
				return -1;
			if(this.getSurname() != null && compareObj.getSurname() == null)
				return 1;
			if(this.getSurname() != null && compareObj.getSurname() != null)
			{
				if(caseInsensitive)
					retVal = this.getSurname().toLowerCase().compareTo(compareObj.getSurname().toLowerCase());
				else
					retVal = this.getSurname().compareTo(compareObj.getSurname());
			}
		}
		if (retVal == 0)
		{
			if(this.getForename() == null && compareObj.getForename() != null)
				return -1;
			if(this.getForename() != null && compareObj.getForename() == null)
				return 1;
			if(this.getForename() != null && compareObj.getForename() != null)
			{
				if(caseInsensitive)
					retVal = this.getForename().toLowerCase().compareTo(compareObj.getForename().toLowerCase());
				else
					retVal = this.getForename().compareTo(compareObj.getForename());
			}
		}
		if (retVal == 0)
		{
			if(this.getHospitalNo() == null && compareObj.getHospitalNo() != null)
				return -1;
			if(this.getHospitalNo() != null && compareObj.getHospitalNo() == null)
				return 1;
			if(this.getHospitalNo() != null && compareObj.getHospitalNo() != null)
			{
				if(caseInsensitive)
					retVal = this.getHospitalNo().toLowerCase().compareTo(compareObj.getHospitalNo().toLowerCase());
				else
					retVal = this.getHospitalNo().compareTo(compareObj.getHospitalNo());
			}
		}
		if (retVal == 0)
		{
			if(this.getRequestor() == null && compareObj.getRequestor() != null)
				return -1;
			if(this.getRequestor() != null && compareObj.getRequestor() == null)
				return 1;
			if(this.getRequestor() != null && compareObj.getRequestor() != null)
				retVal = this.getRequestor().compareTo(compareObj.getRequestor());
		}
		if (retVal == 0)
		{
			if(this.getAllocatedTo() == null && compareObj.getAllocatedTo() != null)
				return -1;
			if(this.getAllocatedTo() != null && compareObj.getAllocatedTo() == null)
				return 1;
			if(this.getAllocatedTo() != null && compareObj.getAllocatedTo() != null)
				retVal = this.getAllocatedTo().compareTo(compareObj.getAllocatedTo());
		}
		if (retVal == 0)
		{
			if(this.getStatus() == null && compareObj.getStatus() != null)
				return -1;
			if(this.getStatus() != null && compareObj.getStatus() == null)
				return 1;
			if(this.getStatus() != null && compareObj.getStatus() != null)
				retVal = this.getStatus().compareTo(compareObj.getStatus());
		}
		if (retVal == 0)
		{
			if(this.getDateFrom() == null && compareObj.getDateFrom() != null)
				return -1;
			if(this.getDateFrom() != null && compareObj.getDateFrom() == null)
				return 1;
			if(this.getDateFrom() != null && compareObj.getDateFrom() != null)
				retVal = this.getDateFrom().compareTo(compareObj.getDateFrom());
		}
		if (retVal == 0)
		{
			if(this.getDateTo() == null && compareObj.getDateTo() != null)
				return -1;
			if(this.getDateTo() != null && compareObj.getDateTo() == null)
				return 1;
			if(this.getDateTo() != null && compareObj.getDateTo() != null)
				retVal = this.getDateTo().compareTo(compareObj.getDateTo());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.surname != null)
			count++;
		if(this.forename != null)
			count++;
		if(this.hospitalno != null)
			count++;
		if(this.requestor != null)
			count++;
		if(this.allocatedto != null)
			count++;
		if(this.status != null)
			count++;
		if(this.datefrom != null)
			count++;
		if(this.dateto != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected String surname;
	protected String forename;
	protected String hospitalno;
	protected ims.core.vo.MemberOfStaffLiteVo requestor;
	protected ims.core.vo.MemberOfStaffLiteVo allocatedto;
	protected ims.ocrr.vo.lookups.PatientClericalTaskStatus status;
	protected ims.framework.utils.Date datefrom;
	protected ims.framework.utils.Date dateto;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
