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

	public PatientDocumentSearchFilterVo()
	{
	}
	public PatientDocumentSearchFilterVo(ims.core.vo.beans.PatientDocumentSearchFilterVoBean bean)
	{
		this.episodeofcare = bean.getEpisodeOfCare() == null ? null : bean.getEpisodeOfCare().buildVo();
		this.speciality = bean.getSpeciality() == null ? null : ims.core.vo.lookups.Specialty.buildLookup(bean.getSpeciality());
		// Interface field type not supported.
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.creationtype = bean.getCreationType() == null ? null : ims.core.vo.lookups.DocumentCreationType.buildLookup(bean.getCreationType());
		this.category = bean.getCategory() == null ? null : ims.core.vo.lookups.DocumentCategory.buildLookup(bean.getCategory());
		this.status = bean.getStatus() == null ? null : ims.core.vo.lookups.DocumentStatus.buildLookup(bean.getStatus());
		// Interface field type not supported.
		this.usegeneratedinsteadofevent = bean.getUseGeneratedInsteadOfEvent();
		this.patient = bean.getPatient() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getPatient().getId()), bean.getPatient().getVersion());
		this.columnsortorder = bean.getColumnSortOrder() == null ? null : bean.getColumnSortOrder().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.PatientDocumentSearchFilterVoBean bean)
	{
		this.episodeofcare = bean.getEpisodeOfCare() == null ? null : bean.getEpisodeOfCare().buildVo(map);
		this.speciality = bean.getSpeciality() == null ? null : ims.core.vo.lookups.Specialty.buildLookup(bean.getSpeciality());
		// Interface field type not supported.
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.creationtype = bean.getCreationType() == null ? null : ims.core.vo.lookups.DocumentCreationType.buildLookup(bean.getCreationType());
		this.category = bean.getCategory() == null ? null : ims.core.vo.lookups.DocumentCategory.buildLookup(bean.getCategory());
		this.status = bean.getStatus() == null ? null : ims.core.vo.lookups.DocumentStatus.buildLookup(bean.getStatus());
		// Interface field type not supported.
		this.usegeneratedinsteadofevent = bean.getUseGeneratedInsteadOfEvent();
		this.patient = bean.getPatient() == null ? null : new ims.core.patient.vo.PatientRefVo(new Integer(bean.getPatient().getId()), bean.getPatient().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.core.vo.beans.PatientDocumentSearchFilterVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.PatientDocumentSearchFilterVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.PatientDocumentSearchFilterVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getEpisodeOfCareIsNotNull()
	{
		return this.episodeofcare != null;
	}
	public ims.core.vo.EpisodeofCareShortVo getEpisodeOfCare()
	{
		return this.episodeofcare;
	}
	public void setEpisodeOfCare(ims.core.vo.EpisodeofCareShortVo value)
	{
		this.isValidated = false;
		this.episodeofcare = value;
	}
	public boolean getSpecialityIsNotNull()
	{
		return this.speciality != null;
	}
	public ims.core.vo.lookups.Specialty getSpeciality()
	{
		return this.speciality;
	}
	public void setSpeciality(ims.core.vo.lookups.Specialty value)
	{
		this.isValidated = false;
		this.speciality = value;
	}
	public boolean getAuthoringHCPIsNotNull()
	{
		return this.authoringhcp != null;
	}
	public ims.vo.interfaces.IMos getAuthoringHCP()
	{
		return this.authoringhcp;
	}
	public void setAuthoringHCP(ims.vo.interfaces.IMos value)
	{
		this.isValidated = false;
		this.authoringhcp = 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 boolean getCreationTypeIsNotNull()
	{
		return this.creationtype != null;
	}
	public ims.core.vo.lookups.DocumentCreationType getCreationType()
	{
		return this.creationtype;
	}
	public void setCreationType(ims.core.vo.lookups.DocumentCreationType value)
	{
		this.isValidated = false;
		this.creationtype = value;
	}
	public boolean getCategoryIsNotNull()
	{
		return this.category != null;
	}
	public ims.core.vo.lookups.DocumentCategory getCategory()
	{
		return this.category;
	}
	public void setCategory(ims.core.vo.lookups.DocumentCategory value)
	{
		this.isValidated = false;
		this.category = value;
	}
	public boolean getStatusIsNotNull()
	{
		return this.status != null;
	}
	public ims.core.vo.lookups.DocumentStatus getStatus()
	{
		return this.status;
	}
	public void setStatus(ims.core.vo.lookups.DocumentStatus value)
	{
		this.isValidated = false;
		this.status = value;
	}
	public boolean getResponsibleHcpIsNotNull()
	{
		return this.responsiblehcp != null;
	}
	public ims.vo.interfaces.IMos getResponsibleHcp()
	{
		return this.responsiblehcp;
	}
	public void setResponsibleHcp(ims.vo.interfaces.IMos value)
	{
		this.isValidated = false;
		this.responsiblehcp = value;
	}
	public boolean getUseGeneratedInsteadOfEventIsNotNull()
	{
		return this.usegeneratedinsteadofevent != null;
	}
	public Boolean getUseGeneratedInsteadOfEvent()
	{
		return this.usegeneratedinsteadofevent;
	}
	public void setUseGeneratedInsteadOfEvent(Boolean value)
	{
		this.isValidated = false;
		this.usegeneratedinsteadofevent = value;
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.patient.vo.PatientRefVo getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.patient.vo.PatientRefVo value)
	{
		this.isValidated = false;
		this.patient = 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 String toString()
	{
		StringBuffer sb = new StringBuffer();
		if(this.episodeofcare != null)
			sb.append(this.episodeofcare);
		return sb.toString();
	}
	public boolean equals(Object obj)
	{
		if(obj == null)
			return false;
		if(!(obj instanceof PatientDocumentSearchFilterVo))
			return false;
		PatientDocumentSearchFilterVo compareObj = (PatientDocumentSearchFilterVo)obj;
		if(this.getEpisodeOfCare() == null && compareObj.getEpisodeOfCare() != null)
			return false;
		if(this.getEpisodeOfCare() != null && compareObj.getEpisodeOfCare() == null)
			return false;
		if(this.getEpisodeOfCare() != null && compareObj.getEpisodeOfCare() != null)
			return this.getEpisodeOfCare().equals(compareObj.getEpisodeOfCare());
		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;
	
		PatientDocumentSearchFilterVo clone = new PatientDocumentSearchFilterVo();
		
		if(this.episodeofcare == null)
			clone.episodeofcare = null;
		else
			clone.episodeofcare = (ims.core.vo.EpisodeofCareShortVo)this.episodeofcare.clone();
		if(this.speciality == null)
			clone.speciality = null;
		else
			clone.speciality = (ims.core.vo.lookups.Specialty)this.speciality.clone();
		clone.authoringhcp = this.authoringhcp;
		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();
		if(this.creationtype == null)
			clone.creationtype = null;
		else
			clone.creationtype = (ims.core.vo.lookups.DocumentCreationType)this.creationtype.clone();
		if(this.category == null)
			clone.category = null;
		else
			clone.category = (ims.core.vo.lookups.DocumentCategory)this.category.clone();
		if(this.status == null)
			clone.status = null;
		else
			clone.status = (ims.core.vo.lookups.DocumentStatus)this.status.clone();
		clone.responsiblehcp = this.responsiblehcp;
		clone.usegeneratedinsteadofevent = this.usegeneratedinsteadofevent;
		clone.patient = this.patient;
		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 (!(PatientDocumentSearchFilterVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PatientDocumentSearchFilterVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		PatientDocumentSearchFilterVo compareObj = (PatientDocumentSearchFilterVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getEpisodeOfCare() == null && compareObj.getEpisodeOfCare() != null)
				return -1;
			if(this.getEpisodeOfCare() != null && compareObj.getEpisodeOfCare() == null)
				return 1;
			if(this.getEpisodeOfCare() != null && compareObj.getEpisodeOfCare() != null)
				retVal = this.getEpisodeOfCare().compareTo(compareObj.getEpisodeOfCare());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.episodeofcare != null)
			count++;
		if(this.speciality != null)
			count++;
		if(this.authoringhcp != null)
			count++;
		if(this.datefrom != null)
			count++;
		if(this.dateto != null)
			count++;
		if(this.creationtype != null)
			count++;
		if(this.category != null)
			count++;
		if(this.status != null)
			count++;
		if(this.responsiblehcp != null)
			count++;
		if(this.usegeneratedinsteadofevent != null)
			count++;
		if(this.patient != null)
			count++;
		if(this.columnsortorder != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 12;
	}
	protected ims.core.vo.EpisodeofCareShortVo episodeofcare;
	protected ims.core.vo.lookups.Specialty speciality;
	protected ims.vo.interfaces.IMos authoringhcp;
	protected ims.framework.utils.Date datefrom;
	protected ims.framework.utils.Date dateto;
	protected ims.core.vo.lookups.DocumentCreationType creationtype;
	protected ims.core.vo.lookups.DocumentCategory category;
	protected ims.core.vo.lookups.DocumentStatus status;
	protected ims.vo.interfaces.IMos responsiblehcp;
	protected Boolean usegeneratedinsteadofevent;
	protected ims.core.patient.vo.PatientRefVo patient;
	protected ims.core.vo.ColumnSortOrderVo columnsortorder;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
