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

	public SurgicalOPNotesFilterVo()
	{
	}
	public SurgicalOPNotesFilterVo(ims.clinical.vo.beans.SurgicalOPNotesFilterVoBean bean)
	{
		this.procedure = bean.getProcedure() == null ? null : bean.getProcedure().buildVo();
		this.diagnosis = bean.getDiagnosis() == null ? null : bean.getDiagnosis().buildVo();
		this.consultant = bean.getConsultant() == null ? null : bean.getConsultant().buildVo();
		this.operatingsurgeon = bean.getOperatingSurgeon() == null ? null : bean.getOperatingSurgeon().buildVo();
		this.completingclinician = bean.getCompletingClinician() == null ? null : bean.getCompletingClinician().buildVo();
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.diagram = bean.getDiagram() == null ? null : bean.getDiagram().buildVo();
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo();
		this.followupordered = bean.getFollowupOrdered() == null ? null : ims.core.vo.lookups.FollowUpType.buildLookup(bean.getFollowupOrdered());
		this.columnsortorder = bean.getColumnSortOrder() == null ? null : bean.getColumnSortOrder().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.SurgicalOPNotesFilterVoBean bean)
	{
		this.procedure = bean.getProcedure() == null ? null : bean.getProcedure().buildVo(map);
		this.diagnosis = bean.getDiagnosis() == null ? null : bean.getDiagnosis().buildVo(map);
		this.consultant = bean.getConsultant() == null ? null : bean.getConsultant().buildVo(map);
		this.operatingsurgeon = bean.getOperatingSurgeon() == null ? null : bean.getOperatingSurgeon().buildVo(map);
		this.completingclinician = bean.getCompletingClinician() == null ? null : bean.getCompletingClinician().buildVo(map);
		this.datefrom = bean.getDateFrom() == null ? null : bean.getDateFrom().buildDate();
		this.dateto = bean.getDateTo() == null ? null : bean.getDateTo().buildDate();
		this.diagram = bean.getDiagram() == null ? null : bean.getDiagram().buildVo(map);
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo(map);
		this.followupordered = bean.getFollowupOrdered() == null ? null : ims.core.vo.lookups.FollowUpType.buildLookup(bean.getFollowupOrdered());
		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.SurgicalOPNotesFilterVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.SurgicalOPNotesFilterVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.SurgicalOPNotesFilterVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getProcedureIsNotNull()
	{
		return this.procedure != null;
	}
	public ims.core.vo.ProcedureLiteVo getProcedure()
	{
		return this.procedure;
	}
	public void setProcedure(ims.core.vo.ProcedureLiteVo value)
	{
		this.isValidated = false;
		this.procedure = value;
	}
	public boolean getDiagnosisIsNotNull()
	{
		return this.diagnosis != null;
	}
	public ims.core.vo.DiagLiteVo getDiagnosis()
	{
		return this.diagnosis;
	}
	public void setDiagnosis(ims.core.vo.DiagLiteVo value)
	{
		this.isValidated = false;
		this.diagnosis = 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 getOperatingSurgeonIsNotNull()
	{
		return this.operatingsurgeon != null;
	}
	public ims.core.vo.HcpLiteVo getOperatingSurgeon()
	{
		return this.operatingsurgeon;
	}
	public void setOperatingSurgeon(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.operatingsurgeon = value;
	}
	public boolean getCompletingClinicianIsNotNull()
	{
		return this.completingclinician != null;
	}
	public ims.core.vo.HcpLiteVo getCompletingClinician()
	{
		return this.completingclinician;
	}
	public void setCompletingClinician(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.completingclinician = 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 getDiagramIsNotNull()
	{
		return this.diagram != null;
	}
	public ims.assessment.vo.GraphicAssessmentShortVo getDiagram()
	{
		return this.diagram;
	}
	public void setDiagram(ims.assessment.vo.GraphicAssessmentShortVo value)
	{
		this.isValidated = false;
		this.diagram = value;
	}
	public boolean getHospitalIsNotNull()
	{
		return this.hospital != null;
	}
	public ims.core.vo.LocationLiteVo getHospital()
	{
		return this.hospital;
	}
	public void setHospital(ims.core.vo.LocationLiteVo value)
	{
		this.isValidated = false;
		this.hospital = value;
	}
	public boolean getFollowupOrderedIsNotNull()
	{
		return this.followupordered != null;
	}
	public ims.core.vo.lookups.FollowUpType getFollowupOrdered()
	{
		return this.followupordered;
	}
	public void setFollowupOrdered(ims.core.vo.lookups.FollowUpType value)
	{
		this.isValidated = false;
		this.followupordered = 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 SurgicalOPNotesFilterVo))
			return false;
		SurgicalOPNotesFilterVo compareObj = (SurgicalOPNotesFilterVo)obj;
		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)
			return this.getDateFrom().equals(compareObj.getDateFrom());
		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;
	
		SurgicalOPNotesFilterVo clone = new SurgicalOPNotesFilterVo();
		
		if(this.procedure == null)
			clone.procedure = null;
		else
			clone.procedure = (ims.core.vo.ProcedureLiteVo)this.procedure.clone();
		if(this.diagnosis == null)
			clone.diagnosis = null;
		else
			clone.diagnosis = (ims.core.vo.DiagLiteVo)this.diagnosis.clone();
		if(this.consultant == null)
			clone.consultant = null;
		else
			clone.consultant = (ims.core.vo.HcpLiteVo)this.consultant.clone();
		if(this.operatingsurgeon == null)
			clone.operatingsurgeon = null;
		else
			clone.operatingsurgeon = (ims.core.vo.HcpLiteVo)this.operatingsurgeon.clone();
		if(this.completingclinician == null)
			clone.completingclinician = null;
		else
			clone.completingclinician = (ims.core.vo.HcpLiteVo)this.completingclinician.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();
		if(this.diagram == null)
			clone.diagram = null;
		else
			clone.diagram = (ims.assessment.vo.GraphicAssessmentShortVo)this.diagram.clone();
		if(this.hospital == null)
			clone.hospital = null;
		else
			clone.hospital = (ims.core.vo.LocationLiteVo)this.hospital.clone();
		if(this.followupordered == null)
			clone.followupordered = null;
		else
			clone.followupordered = (ims.core.vo.lookups.FollowUpType)this.followupordered.clone();
		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 (!(SurgicalOPNotesFilterVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A SurgicalOPNotesFilterVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		SurgicalOPNotesFilterVo compareObj = (SurgicalOPNotesFilterVo)obj;
		int retVal = 0;
		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());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.procedure != null)
			count++;
		if(this.diagnosis != null)
			count++;
		if(this.consultant != null)
			count++;
		if(this.operatingsurgeon != null)
			count++;
		if(this.completingclinician != null)
			count++;
		if(this.datefrom != null)
			count++;
		if(this.dateto != null)
			count++;
		if(this.diagram != null)
			count++;
		if(this.hospital != null)
			count++;
		if(this.followupordered != null)
			count++;
		if(this.columnsortorder != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 11;
	}
	protected ims.core.vo.ProcedureLiteVo procedure;
	protected ims.core.vo.DiagLiteVo diagnosis;
	protected ims.core.vo.HcpLiteVo consultant;
	protected ims.core.vo.HcpLiteVo operatingsurgeon;
	protected ims.core.vo.HcpLiteVo completingclinician;
	protected ims.framework.utils.Date datefrom;
	protected ims.framework.utils.Date dateto;
	protected ims.assessment.vo.GraphicAssessmentShortVo diagram;
	protected ims.core.vo.LocationLiteVo hospital;
	protected ims.core.vo.lookups.FollowUpType followupordered;
	protected ims.core.vo.ColumnSortOrderVo columnsortorder;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
