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

/**
 * Linked to core.patient.Patient business object (ID: 1001100000).
 */
public class PDSPatientFilterSearchCriteriaVo extends ims.core.patient.vo.PatientRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PDSPatientFilterSearchCriteriaVo()
	{
	}
	public PDSPatientFilterSearchCriteriaVo(Integer id, int version)
	{
		super(id, version);
	}
	public PDSPatientFilterSearchCriteriaVo(ims.core.vo.beans.PDSPatientFilterSearchCriteriaVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
		this.dob = bean.getDob() == null ? null : bean.getDob().buildPartialDate();
		this.surname = bean.getSurname();
		this.forename = bean.getForename();
		this.forename2 = bean.getForename2();
		this.county = bean.getCounty() == null ? null : ims.ntpf.vo.lookups.County.buildLookup(bean.getCounty());
		this.address = bean.getAddress();
		this.persid = bean.getPersId() == null ? null : bean.getPersId().buildVo();
		this.cca = bean.getCCA() == null ? null : bean.getCCA().buildVo();
		this.excludequickregistrationpatients = bean.getExcludeQuickRegistrationPatients();
		this.excludedeceseadpatients = bean.getExcludeDeceseadPatients();
		this.postcode = bean.getPostCode();
		this.nhsnumber = bean.getNHSNumber();
		this.dod = bean.getDoD() == null ? null : bean.getDoD().buildPartialDate();
		this.gp = bean.getGP();
		this.algorithmictrace = bean.getAlgorithmicTrace();
		this.includealias = bean.getIncludeAlias();
		this.swapnames = bean.getSwapNames();
		this.extendeddob = bean.getExtendedDoB();
		this.extendeddod = bean.getExtendedDoD();
		this.searchtab = bean.getSearchTab();
		this.wastimeron = bean.getWasTimerOn();
		this.surnameorig = bean.getSurnameOrig();
		this.forenameorig = bean.getForenameOrig();
		this.postcodeorig = bean.getPostcodeOrig();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.PDSPatientFilterSearchCriteriaVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
		this.dob = bean.getDob() == null ? null : bean.getDob().buildPartialDate();
		this.surname = bean.getSurname();
		this.forename = bean.getForename();
		this.forename2 = bean.getForename2();
		this.county = bean.getCounty() == null ? null : ims.ntpf.vo.lookups.County.buildLookup(bean.getCounty());
		this.address = bean.getAddress();
		this.persid = bean.getPersId() == null ? null : bean.getPersId().buildVo(map);
		this.cca = bean.getCCA() == null ? null : bean.getCCA().buildVo(map);
		this.excludequickregistrationpatients = bean.getExcludeQuickRegistrationPatients();
		this.excludedeceseadpatients = bean.getExcludeDeceseadPatients();
		this.postcode = bean.getPostCode();
		this.nhsnumber = bean.getNHSNumber();
		this.dod = bean.getDoD() == null ? null : bean.getDoD().buildPartialDate();
		this.gp = bean.getGP();
		this.algorithmictrace = bean.getAlgorithmicTrace();
		this.includealias = bean.getIncludeAlias();
		this.swapnames = bean.getSwapNames();
		this.extendeddob = bean.getExtendedDoB();
		this.extendeddod = bean.getExtendedDoD();
		this.searchtab = bean.getSearchTab();
		this.wastimeron = bean.getWasTimerOn();
		this.surnameorig = bean.getSurnameOrig();
		this.forenameorig = bean.getForenameOrig();
		this.postcodeorig = bean.getPostcodeOrig();
	}
	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.PDSPatientFilterSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.PDSPatientFilterSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.PDSPatientFilterSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public Object getFieldValueByFieldName(String fieldName)
	{
		if(fieldName == null)
			throw new ims.framework.exceptions.CodingRuntimeException("Invalid field name");
		fieldName = fieldName.toUpperCase();
		if(fieldName.equals("SEX"))
			return getSex();
		if(fieldName.equals("DOB"))
			return getDob();
		if(fieldName.equals("SURNAME"))
			return getSurname();
		if(fieldName.equals("FORENAME"))
			return getForename();
		if(fieldName.equals("FORENAME2"))
			return getForename2();
		if(fieldName.equals("COUNTY"))
			return getCounty();
		if(fieldName.equals("ADDRESS"))
			return getAddress();
		if(fieldName.equals("PERSID"))
			return getPersId();
		if(fieldName.equals("CCA"))
			return getCCA();
		if(fieldName.equals("EXCLUDEQUICKREGISTRATIONPATIENTS"))
			return getExcludeQuickRegistrationPatients();
		if(fieldName.equals("EXCLUDEDECESEADPATIENTS"))
			return getExcludeDeceseadPatients();
		if(fieldName.equals("POSTCODE"))
			return getPostCode();
		if(fieldName.equals("NHSNUMBER"))
			return getNHSNumber();
		if(fieldName.equals("DOD"))
			return getDoD();
		if(fieldName.equals("GP"))
			return getGP();
		if(fieldName.equals("ALGORITHMICTRACE"))
			return getAlgorithmicTrace();
		if(fieldName.equals("INCLUDEALIAS"))
			return getIncludeAlias();
		if(fieldName.equals("SWAPNAMES"))
			return getSwapNames();
		if(fieldName.equals("EXTENDEDDOB"))
			return getExtendedDoB();
		if(fieldName.equals("EXTENDEDDOD"))
			return getExtendedDoD();
		if(fieldName.equals("SEARCHTAB"))
			return getSearchTab();
		if(fieldName.equals("WASTIMERON"))
			return getWasTimerOn();
		if(fieldName.equals("SURNAMEORIG"))
			return getSurnameOrig();
		if(fieldName.equals("FORENAMEORIG"))
			return getForenameOrig();
		if(fieldName.equals("POSTCODEORIG"))
			return getPostcodeOrig();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getSexIsNotNull()
	{
		return this.sex != null;
	}
	public ims.core.vo.lookups.Sex getSex()
	{
		return this.sex;
	}
	public void setSex(ims.core.vo.lookups.Sex value)
	{
		this.isValidated = false;
		this.sex = value;
	}
	public boolean getDobIsNotNull()
	{
		return this.dob != null;
	}
	public ims.framework.utils.PartialDate getDob()
	{
		return this.dob;
	}
	public void setDob(ims.framework.utils.PartialDate value)
	{
		this.isValidated = false;
		this.dob = value;
	}
	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 getForename2IsNotNull()
	{
		return this.forename2 != null;
	}
	public String getForename2()
	{
		return this.forename2;
	}
	public static int getForename2MaxLength()
	{
		return 255;
	}
	public void setForename2(String value)
	{
		this.isValidated = false;
		this.forename2 = value;
	}
	public boolean getCountyIsNotNull()
	{
		return this.county != null;
	}
	public ims.ntpf.vo.lookups.County getCounty()
	{
		return this.county;
	}
	public void setCounty(ims.ntpf.vo.lookups.County value)
	{
		this.isValidated = false;
		this.county = value;
	}
	public boolean getAddressIsNotNull()
	{
		return this.address != null;
	}
	public String getAddress()
	{
		return this.address;
	}
	public static int getAddressMaxLength()
	{
		return 255;
	}
	public void setAddress(String value)
	{
		this.isValidated = false;
		this.address = value;
	}
	public boolean getPersIdIsNotNull()
	{
		return this.persid != null;
	}
	public ims.core.vo.PatientId getPersId()
	{
		return this.persid;
	}
	public void setPersId(ims.core.vo.PatientId value)
	{
		this.isValidated = false;
		this.persid = value;
	}
	public boolean getCCAIsNotNull()
	{
		return this.cca != null;
	}
	public ims.core.vo.LocSiteLiteVo getCCA()
	{
		return this.cca;
	}
	public void setCCA(ims.core.vo.LocSiteLiteVo value)
	{
		this.isValidated = false;
		this.cca = value;
	}
	public boolean getExcludeQuickRegistrationPatientsIsNotNull()
	{
		return this.excludequickregistrationpatients != null;
	}
	public Boolean getExcludeQuickRegistrationPatients()
	{
		return this.excludequickregistrationpatients;
	}
	public void setExcludeQuickRegistrationPatients(Boolean value)
	{
		this.isValidated = false;
		this.excludequickregistrationpatients = value;
	}
	public boolean getExcludeDeceseadPatientsIsNotNull()
	{
		return this.excludedeceseadpatients != null;
	}
	public Boolean getExcludeDeceseadPatients()
	{
		return this.excludedeceseadpatients;
	}
	public void setExcludeDeceseadPatients(Boolean value)
	{
		this.isValidated = false;
		this.excludedeceseadpatients = value;
	}
	public boolean getPostCodeIsNotNull()
	{
		return this.postcode != null;
	}
	public String getPostCode()
	{
		return this.postcode;
	}
	public static int getPostCodeMaxLength()
	{
		return 255;
	}
	public void setPostCode(String value)
	{
		this.isValidated = false;
		this.postcode = value;
	}
	public boolean getNHSNumberIsNotNull()
	{
		return this.nhsnumber != null;
	}
	public String getNHSNumber()
	{
		return this.nhsnumber;
	}
	public static int getNHSNumberMaxLength()
	{
		return 255;
	}
	public void setNHSNumber(String value)
	{
		this.isValidated = false;
		this.nhsnumber = value;
	}
	public boolean getDoDIsNotNull()
	{
		return this.dod != null;
	}
	public ims.framework.utils.PartialDate getDoD()
	{
		return this.dod;
	}
	public void setDoD(ims.framework.utils.PartialDate value)
	{
		this.isValidated = false;
		this.dod = value;
	}
	public boolean getGPIsNotNull()
	{
		return this.gp != null;
	}
	public String getGP()
	{
		return this.gp;
	}
	public static int getGPMaxLength()
	{
		return 255;
	}
	public void setGP(String value)
	{
		this.isValidated = false;
		this.gp = value;
	}
	public boolean getAlgorithmicTraceIsNotNull()
	{
		return this.algorithmictrace != null;
	}
	public Boolean getAlgorithmicTrace()
	{
		return this.algorithmictrace;
	}
	public void setAlgorithmicTrace(Boolean value)
	{
		this.isValidated = false;
		this.algorithmictrace = value;
	}
	public boolean getIncludeAliasIsNotNull()
	{
		return this.includealias != null;
	}
	public Boolean getIncludeAlias()
	{
		return this.includealias;
	}
	public void setIncludeAlias(Boolean value)
	{
		this.isValidated = false;
		this.includealias = value;
	}
	public boolean getSwapNamesIsNotNull()
	{
		return this.swapnames != null;
	}
	public Boolean getSwapNames()
	{
		return this.swapnames;
	}
	public void setSwapNames(Boolean value)
	{
		this.isValidated = false;
		this.swapnames = value;
	}
	public boolean getExtendedDoBIsNotNull()
	{
		return this.extendeddob != null;
	}
	public Boolean getExtendedDoB()
	{
		return this.extendeddob;
	}
	public void setExtendedDoB(Boolean value)
	{
		this.isValidated = false;
		this.extendeddob = value;
	}
	public boolean getExtendedDoDIsNotNull()
	{
		return this.extendeddod != null;
	}
	public Boolean getExtendedDoD()
	{
		return this.extendeddod;
	}
	public void setExtendedDoD(Boolean value)
	{
		this.isValidated = false;
		this.extendeddod = value;
	}
	public boolean getSearchTabIsNotNull()
	{
		return this.searchtab != null;
	}
	public Integer getSearchTab()
	{
		return this.searchtab;
	}
	public void setSearchTab(Integer value)
	{
		this.isValidated = false;
		this.searchtab = 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 getSurnameOrigIsNotNull()
	{
		return this.surnameorig != null;
	}
	public String getSurnameOrig()
	{
		return this.surnameorig;
	}
	public static int getSurnameOrigMaxLength()
	{
		return 255;
	}
	public void setSurnameOrig(String value)
	{
		this.isValidated = false;
		this.surnameorig = value;
	}
	public boolean getForenameOrigIsNotNull()
	{
		return this.forenameorig != null;
	}
	public String getForenameOrig()
	{
		return this.forenameorig;
	}
	public static int getForenameOrigMaxLength()
	{
		return 255;
	}
	public void setForenameOrig(String value)
	{
		this.isValidated = false;
		this.forenameorig = value;
	}
	public boolean getPostcodeOrigIsNotNull()
	{
		return this.postcodeorig != null;
	}
	public String getPostcodeOrig()
	{
		return this.postcodeorig;
	}
	public static int getPostcodeOrigMaxLength()
	{
		return 255;
	}
	public void setPostcodeOrig(String value)
	{
		this.isValidated = false;
		this.postcodeorig = value;
	}
	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 void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		PDSPatientFilterSearchCriteriaVo clone = new PDSPatientFilterSearchCriteriaVo(this.id, this.version);
		
		if(this.sex == null)
			clone.sex = null;
		else
			clone.sex = (ims.core.vo.lookups.Sex)this.sex.clone();
		if(this.dob == null)
			clone.dob = null;
		else
			clone.dob = (ims.framework.utils.PartialDate)this.dob.clone();
		clone.surname = this.surname;
		clone.forename = this.forename;
		clone.forename2 = this.forename2;
		if(this.county == null)
			clone.county = null;
		else
			clone.county = (ims.ntpf.vo.lookups.County)this.county.clone();
		clone.address = this.address;
		if(this.persid == null)
			clone.persid = null;
		else
			clone.persid = (ims.core.vo.PatientId)this.persid.clone();
		if(this.cca == null)
			clone.cca = null;
		else
			clone.cca = (ims.core.vo.LocSiteLiteVo)this.cca.clone();
		clone.excludequickregistrationpatients = this.excludequickregistrationpatients;
		clone.excludedeceseadpatients = this.excludedeceseadpatients;
		clone.postcode = this.postcode;
		clone.nhsnumber = this.nhsnumber;
		if(this.dod == null)
			clone.dod = null;
		else
			clone.dod = (ims.framework.utils.PartialDate)this.dod.clone();
		clone.gp = this.gp;
		clone.algorithmictrace = this.algorithmictrace;
		clone.includealias = this.includealias;
		clone.swapnames = this.swapnames;
		clone.extendeddob = this.extendeddob;
		clone.extendeddod = this.extendeddod;
		clone.searchtab = this.searchtab;
		clone.wastimeron = this.wastimeron;
		clone.surnameorig = this.surnameorig;
		clone.forenameorig = this.forenameorig;
		clone.postcodeorig = this.postcodeorig;
		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 (!(PDSPatientFilterSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PDSPatientFilterSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PDSPatientFilterSearchCriteriaVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PDSPatientFilterSearchCriteriaVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.sex != null)
			count++;
		if(this.dob != null)
			count++;
		if(this.surname != null)
			count++;
		if(this.forename != null)
			count++;
		if(this.forename2 != null)
			count++;
		if(this.county != null)
			count++;
		if(this.address != null)
			count++;
		if(this.persid != null)
			count++;
		if(this.cca != null)
			count++;
		if(this.excludequickregistrationpatients != null)
			count++;
		if(this.excludedeceseadpatients != null)
			count++;
		if(this.postcode != null)
			count++;
		if(this.nhsnumber != null)
			count++;
		if(this.dod != null)
			count++;
		if(this.gp != null)
			count++;
		if(this.algorithmictrace != null)
			count++;
		if(this.includealias != null)
			count++;
		if(this.swapnames != null)
			count++;
		if(this.extendeddob != null)
			count++;
		if(this.extendeddod != null)
			count++;
		if(this.searchtab != null)
			count++;
		if(this.wastimeron != null)
			count++;
		if(this.surnameorig != null)
			count++;
		if(this.forenameorig != null)
			count++;
		if(this.postcodeorig != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 25;
	}
	protected ims.core.vo.lookups.Sex sex;
	protected ims.framework.utils.PartialDate dob;
	protected String surname;
	protected String forename;
	protected String forename2;
	protected ims.ntpf.vo.lookups.County county;
	protected String address;
	protected ims.core.vo.PatientId persid;
	protected ims.core.vo.LocSiteLiteVo cca;
	protected Boolean excludequickregistrationpatients;
	protected Boolean excludedeceseadpatients;
	protected String postcode;
	protected String nhsnumber;
	protected ims.framework.utils.PartialDate dod;
	protected String gp;
	protected Boolean algorithmictrace;
	protected Boolean includealias;
	protected Boolean swapnames;
	protected Boolean extendeddob;
	protected Boolean extendeddod;
	protected Integer searchtab;
	protected Boolean wastimeron;
	protected String surnameorig;
	protected String forenameorig;
	protected String postcodeorig;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
