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

	public EDischargeSearchCriteriaVo()
	{
	}
	public EDischargeSearchCriteriaVo(ims.clinical.vo.beans.EDischargeSearchCriteriaVoBean bean)
	{
		this.completinghcp = bean.getCompletingHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getCompletingHCP().getId()), bean.getCompletingHCP().getVersion());
		this.initiatinghcp = bean.getInitiatingHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getInitiatingHCP().getId()), bean.getInitiatingHCP().getVersion());
		this.responsiblehcp = bean.getResponsibleHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getResponsibleHCP().getId()), bean.getResponsibleHCP().getVersion());
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.ward = bean.getWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getWard().getId()), bean.getWard().getVersion());
		this.status = bean.getStatus() == null ? null : ims.clinical.vo.lookups.DischargeLetterStatus.buildLookup(bean.getStatus());
		this.specialty = bean.getSpecialty() == null ? null : ims.core.vo.lookups.Specialty.buildLookup(bean.getSpecialty());
		this.fromdate = bean.getFromDate() == null ? null : bean.getFromDate().buildDate();
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
		this.clinicadetailscomplete = bean.getClinicaDetailsComplete() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getClinicaDetailsComplete());
		this.tta = bean.getTTA() == null ? null : ims.clinical.vo.lookups.TTORequired.buildLookup(bean.getTTA());
		this.ttafeedback = bean.getTTAFeedBack();
		this.noncornish = bean.getNonCornish();
		this.ttastatus = bean.getTTAStatus() == null ? null : ims.clinical.vo.lookups.TTAStatus.buildLookup(bean.getTTAStatus());
		this.completing = bean.getCompleting();
		this.excludedischarged = bean.getExcludeDischarged();
		this.searchtype = bean.getSearchType();
		this.currentward = bean.getCurrentWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getCurrentWard().getId()), bean.getCurrentWard().getVersion());
		this.columnsortorder = bean.getColumnSortOrder() == null ? null : bean.getColumnSortOrder().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.EDischargeSearchCriteriaVoBean bean)
	{
		this.completinghcp = bean.getCompletingHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getCompletingHCP().getId()), bean.getCompletingHCP().getVersion());
		this.initiatinghcp = bean.getInitiatingHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getInitiatingHCP().getId()), bean.getInitiatingHCP().getVersion());
		this.responsiblehcp = bean.getResponsibleHCP() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getResponsibleHCP().getId()), bean.getResponsibleHCP().getVersion());
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.ward = bean.getWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getWard().getId()), bean.getWard().getVersion());
		this.status = bean.getStatus() == null ? null : ims.clinical.vo.lookups.DischargeLetterStatus.buildLookup(bean.getStatus());
		this.specialty = bean.getSpecialty() == null ? null : ims.core.vo.lookups.Specialty.buildLookup(bean.getSpecialty());
		this.fromdate = bean.getFromDate() == null ? null : bean.getFromDate().buildDate();
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
		this.clinicadetailscomplete = bean.getClinicaDetailsComplete() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getClinicaDetailsComplete());
		this.tta = bean.getTTA() == null ? null : ims.clinical.vo.lookups.TTORequired.buildLookup(bean.getTTA());
		this.ttafeedback = bean.getTTAFeedBack();
		this.noncornish = bean.getNonCornish();
		this.ttastatus = bean.getTTAStatus() == null ? null : ims.clinical.vo.lookups.TTAStatus.buildLookup(bean.getTTAStatus());
		this.completing = bean.getCompleting();
		this.excludedischarged = bean.getExcludeDischarged();
		this.searchtype = bean.getSearchType();
		this.currentward = bean.getCurrentWard() == null ? null : new ims.core.resource.place.vo.LocationRefVo(new Integer(bean.getCurrentWard().getId()), bean.getCurrentWard().getVersion());
		this.columnsortorder = bean.getColumnSortOrder() == null ? null : bean.getColumnSortOrder().buildVo(map);
	}
	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.EDischargeSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.EDischargeSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.EDischargeSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getCompletingHCPIsNotNull()
	{
		return this.completinghcp != null;
	}
	public ims.core.resource.people.vo.HcpRefVo getCompletingHCP()
	{
		return this.completinghcp;
	}
	public void setCompletingHCP(ims.core.resource.people.vo.HcpRefVo value)
	{
		this.isValidated = false;
		this.completinghcp = value;
	}
	public boolean getInitiatingHCPIsNotNull()
	{
		return this.initiatinghcp != null;
	}
	public ims.core.resource.people.vo.HcpRefVo getInitiatingHCP()
	{
		return this.initiatinghcp;
	}
	public void setInitiatingHCP(ims.core.resource.people.vo.HcpRefVo value)
	{
		this.isValidated = false;
		this.initiatinghcp = value;
	}
	public boolean getResponsibleHCPIsNotNull()
	{
		return this.responsiblehcp != null;
	}
	public ims.core.resource.people.vo.HcpRefVo getResponsibleHCP()
	{
		return this.responsiblehcp;
	}
	public void setResponsibleHCP(ims.core.resource.people.vo.HcpRefVo value)
	{
		this.isValidated = false;
		this.responsiblehcp = value;
	}
	public boolean getCareContextIsNotNull()
	{
		return this.carecontext != null;
	}
	public ims.core.admin.vo.CareContextRefVo getCareContext()
	{
		return this.carecontext;
	}
	public void setCareContext(ims.core.admin.vo.CareContextRefVo value)
	{
		this.isValidated = false;
		this.carecontext = value;
	}
	public boolean getWardIsNotNull()
	{
		return this.ward != null;
	}
	public ims.core.resource.place.vo.LocationRefVo getWard()
	{
		return this.ward;
	}
	public void setWard(ims.core.resource.place.vo.LocationRefVo value)
	{
		this.isValidated = false;
		this.ward = value;
	}
	public boolean getStatusIsNotNull()
	{
		return this.status != null;
	}
	public ims.clinical.vo.lookups.DischargeLetterStatus getStatus()
	{
		return this.status;
	}
	public void setStatus(ims.clinical.vo.lookups.DischargeLetterStatus value)
	{
		this.isValidated = false;
		this.status = value;
	}
	public boolean getSpecialtyIsNotNull()
	{
		return this.specialty != null;
	}
	public ims.core.vo.lookups.Specialty getSpecialty()
	{
		return this.specialty;
	}
	public void setSpecialty(ims.core.vo.lookups.Specialty value)
	{
		this.isValidated = false;
		this.specialty = 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 boolean getClinicaDetailsCompleteIsNotNull()
	{
		return this.clinicadetailscomplete != null;
	}
	public ims.core.vo.lookups.YesNo getClinicaDetailsComplete()
	{
		return this.clinicadetailscomplete;
	}
	public void setClinicaDetailsComplete(ims.core.vo.lookups.YesNo value)
	{
		this.isValidated = false;
		this.clinicadetailscomplete = value;
	}
	public boolean getTTAIsNotNull()
	{
		return this.tta != null;
	}
	public ims.clinical.vo.lookups.TTORequired getTTA()
	{
		return this.tta;
	}
	public void setTTA(ims.clinical.vo.lookups.TTORequired value)
	{
		this.isValidated = false;
		this.tta = value;
	}
	public boolean getTTAFeedBackIsNotNull()
	{
		return this.ttafeedback != null;
	}
	public Boolean getTTAFeedBack()
	{
		return this.ttafeedback;
	}
	public void setTTAFeedBack(Boolean value)
	{
		this.isValidated = false;
		this.ttafeedback = value;
	}
	public boolean getNonCornishIsNotNull()
	{
		return this.noncornish != null;
	}
	public Boolean getNonCornish()
	{
		return this.noncornish;
	}
	public void setNonCornish(Boolean value)
	{
		this.isValidated = false;
		this.noncornish = value;
	}
	public boolean getTTAStatusIsNotNull()
	{
		return this.ttastatus != null;
	}
	public ims.clinical.vo.lookups.TTAStatus getTTAStatus()
	{
		return this.ttastatus;
	}
	public void setTTAStatus(ims.clinical.vo.lookups.TTAStatus value)
	{
		this.isValidated = false;
		this.ttastatus = value;
	}
	public boolean getCompletingIsNotNull()
	{
		return this.completing != null;
	}
	public Boolean getCompleting()
	{
		return this.completing;
	}
	public void setCompleting(Boolean value)
	{
		this.isValidated = false;
		this.completing = value;
	}
	public boolean getExcludeDischargedIsNotNull()
	{
		return this.excludedischarged != null;
	}
	public Boolean getExcludeDischarged()
	{
		return this.excludedischarged;
	}
	public void setExcludeDischarged(Boolean value)
	{
		this.isValidated = false;
		this.excludedischarged = value;
	}
	public boolean getSearchTypeIsNotNull()
	{
		return this.searchtype != null;
	}
	public Integer getSearchType()
	{
		return this.searchtype;
	}
	public void setSearchType(Integer value)
	{
		this.isValidated = false;
		this.searchtype = value;
	}
	public boolean getCurrentWardIsNotNull()
	{
		return this.currentward != null;
	}
	public ims.core.resource.place.vo.LocationRefVo getCurrentWard()
	{
		return this.currentward;
	}
	public void setCurrentWard(ims.core.resource.place.vo.LocationRefVo value)
	{
		this.isValidated = false;
		this.currentward = value;
	}
	public boolean getColumnSortOrderIsNotNull()
	{
		return this.columnsortorder != null;
	}
	public ims.core.vo.ColumnSortOrderVo getColumnSortOrder()
	{
		return this.columnsortorder;
	}
	public void setColumnSortOrder(ims.core.vo.ColumnSortOrderVo value)
	{
		this.isValidated = false;
		this.columnsortorder = 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 EDischargeSearchCriteriaVo))
			return false;
		EDischargeSearchCriteriaVo compareObj = (EDischargeSearchCriteriaVo)obj;
		if(this.getCompletingHCP() == null && compareObj.getCompletingHCP() != null)
			return false;
		if(this.getCompletingHCP() != null && compareObj.getCompletingHCP() == null)
			return false;
		if(this.getCompletingHCP() != null && compareObj.getCompletingHCP() != null)
			return this.getCompletingHCP().equals(compareObj.getCompletingHCP());
		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;
	
		EDischargeSearchCriteriaVo clone = new EDischargeSearchCriteriaVo();
		
		clone.completinghcp = this.completinghcp;
		clone.initiatinghcp = this.initiatinghcp;
		clone.responsiblehcp = this.responsiblehcp;
		clone.carecontext = this.carecontext;
		clone.ward = this.ward;
		if(this.status == null)
			clone.status = null;
		else
			clone.status = (ims.clinical.vo.lookups.DischargeLetterStatus)this.status.clone();
		if(this.specialty == null)
			clone.specialty = null;
		else
			clone.specialty = (ims.core.vo.lookups.Specialty)this.specialty.clone();
		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();
		if(this.clinicadetailscomplete == null)
			clone.clinicadetailscomplete = null;
		else
			clone.clinicadetailscomplete = (ims.core.vo.lookups.YesNo)this.clinicadetailscomplete.clone();
		if(this.tta == null)
			clone.tta = null;
		else
			clone.tta = (ims.clinical.vo.lookups.TTORequired)this.tta.clone();
		clone.ttafeedback = this.ttafeedback;
		clone.noncornish = this.noncornish;
		if(this.ttastatus == null)
			clone.ttastatus = null;
		else
			clone.ttastatus = (ims.clinical.vo.lookups.TTAStatus)this.ttastatus.clone();
		clone.completing = this.completing;
		clone.excludedischarged = this.excludedischarged;
		clone.searchtype = this.searchtype;
		clone.currentward = this.currentward;
		if(this.columnsortorder == null)
			clone.columnsortorder = null;
		else
			clone.columnsortorder = (ims.core.vo.ColumnSortOrderVo)this.columnsortorder.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 (!(EDischargeSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A EDischargeSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		EDischargeSearchCriteriaVo compareObj = (EDischargeSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getCompletingHCP() == null && compareObj.getCompletingHCP() != null)
				return -1;
			if(this.getCompletingHCP() != null && compareObj.getCompletingHCP() == null)
				return 1;
			if(this.getCompletingHCP() != null && compareObj.getCompletingHCP() != null)
				retVal = this.getCompletingHCP().compareTo(compareObj.getCompletingHCP());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.completinghcp != null)
			count++;
		if(this.initiatinghcp != null)
			count++;
		if(this.responsiblehcp != null)
			count++;
		if(this.carecontext != null)
			count++;
		if(this.ward != null)
			count++;
		if(this.status != null)
			count++;
		if(this.specialty != null)
			count++;
		if(this.fromdate != null)
			count++;
		if(this.todate != null)
			count++;
		if(this.clinicadetailscomplete != null)
			count++;
		if(this.tta != null)
			count++;
		if(this.ttafeedback != null)
			count++;
		if(this.noncornish != null)
			count++;
		if(this.ttastatus != null)
			count++;
		if(this.completing != null)
			count++;
		if(this.excludedischarged != null)
			count++;
		if(this.searchtype != null)
			count++;
		if(this.currentward != null)
			count++;
		if(this.columnsortorder != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 19;
	}
	protected ims.core.resource.people.vo.HcpRefVo completinghcp;
	protected ims.core.resource.people.vo.HcpRefVo initiatinghcp;
	protected ims.core.resource.people.vo.HcpRefVo responsiblehcp;
	protected ims.core.admin.vo.CareContextRefVo carecontext;
	protected ims.core.resource.place.vo.LocationRefVo ward;
	protected ims.clinical.vo.lookups.DischargeLetterStatus status;
	protected ims.core.vo.lookups.Specialty specialty;
	protected ims.framework.utils.Date fromdate;
	protected ims.framework.utils.Date todate;
	protected ims.core.vo.lookups.YesNo clinicadetailscomplete;
	protected ims.clinical.vo.lookups.TTORequired tta;
	protected Boolean ttafeedback;
	protected Boolean noncornish;
	protected ims.clinical.vo.lookups.TTAStatus ttastatus;
	protected Boolean completing;
	protected Boolean excludedischarged;
	protected Integer searchtype;
	protected ims.core.resource.place.vo.LocationRefVo currentward;
	protected ims.core.vo.ColumnSortOrderVo columnsortorder;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
