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

	public AcuteTheatreListFilterVo()
	{
	}
	public AcuteTheatreListFilterVo(ims.clinical.vo.beans.AcuteTheatreListFilterVoBean bean)
	{
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo();
		this.listowner = bean.getListowner() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getListowner().getId()), bean.getListowner().getVersion());
		this.sessiondate = bean.getSessionDate() == null ? null : bean.getSessionDate().buildDate();
		this.profile = bean.getProfile() == null ? null : bean.getProfile().buildVo();
		this.sessiontype = bean.getSessionType() == null ? null : ims.scheduling.vo.lookups.TheatreType.buildLookup(bean.getSessionType());
		this.wastimeron = bean.getWasTimerOn();
		this.listtype = bean.getListType() == null ? null : ims.scheduling.vo.lookups.ProfileListType.buildLookup(bean.getListType());
		this.theatrelocation = bean.getTheatreLocation() == null ? null : bean.getTheatreLocation().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.AcuteTheatreListFilterVoBean bean)
	{
		this.hospital = bean.getHospital() == null ? null : bean.getHospital().buildVo(map);
		this.listowner = bean.getListowner() == null ? null : new ims.core.resource.people.vo.HcpRefVo(new Integer(bean.getListowner().getId()), bean.getListowner().getVersion());
		this.sessiondate = bean.getSessionDate() == null ? null : bean.getSessionDate().buildDate();
		this.profile = bean.getProfile() == null ? null : bean.getProfile().buildVo(map);
		this.sessiontype = bean.getSessionType() == null ? null : ims.scheduling.vo.lookups.TheatreType.buildLookup(bean.getSessionType());
		this.wastimeron = bean.getWasTimerOn();
		this.listtype = bean.getListType() == null ? null : ims.scheduling.vo.lookups.ProfileListType.buildLookup(bean.getListType());
		this.theatrelocation = bean.getTheatreLocation() == null ? null : bean.getTheatreLocation().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.AcuteTheatreListFilterVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.AcuteTheatreListFilterVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.AcuteTheatreListFilterVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getHospitalIsNotNull()
	{
		return this.hospital != null;
	}
	public ims.core.vo.LocShortMappingsVo getHospital()
	{
		return this.hospital;
	}
	public void setHospital(ims.core.vo.LocShortMappingsVo value)
	{
		this.isValidated = false;
		this.hospital = value;
	}
	public boolean getListownerIsNotNull()
	{
		return this.listowner != null;
	}
	public ims.core.resource.people.vo.HcpRefVo getListowner()
	{
		return this.listowner;
	}
	public void setListowner(ims.core.resource.people.vo.HcpRefVo value)
	{
		this.isValidated = false;
		this.listowner = value;
	}
	public boolean getSessionDateIsNotNull()
	{
		return this.sessiondate != null;
	}
	public ims.framework.utils.Date getSessionDate()
	{
		return this.sessiondate;
	}
	public void setSessionDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.sessiondate = value;
	}
	public boolean getProfileIsNotNull()
	{
		return this.profile != null;
	}
	public ims.scheduling.vo.SessionShortVo getProfile()
	{
		return this.profile;
	}
	public void setProfile(ims.scheduling.vo.SessionShortVo value)
	{
		this.isValidated = false;
		this.profile = value;
	}
	public boolean getSessionTypeIsNotNull()
	{
		return this.sessiontype != null;
	}
	public ims.scheduling.vo.lookups.TheatreType getSessionType()
	{
		return this.sessiontype;
	}
	public void setSessionType(ims.scheduling.vo.lookups.TheatreType value)
	{
		this.isValidated = false;
		this.sessiontype = 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 getListTypeIsNotNull()
	{
		return this.listtype != null;
	}
	public ims.scheduling.vo.lookups.ProfileListType getListType()
	{
		return this.listtype;
	}
	public void setListType(ims.scheduling.vo.lookups.ProfileListType value)
	{
		this.isValidated = false;
		this.listtype = value;
	}
	public boolean getTheatreLocationIsNotNull()
	{
		return this.theatrelocation != null;
	}
	public ims.core.vo.LocShortMappingsVo getTheatreLocation()
	{
		return this.theatrelocation;
	}
	public void setTheatreLocation(ims.core.vo.LocShortMappingsVo value)
	{
		this.isValidated = false;
		this.theatrelocation = 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 AcuteTheatreListFilterVo))
			return false;
		AcuteTheatreListFilterVo compareObj = (AcuteTheatreListFilterVo)obj;
		if(this.getHospital() == null && compareObj.getHospital() != null)
			return false;
		if(this.getHospital() != null && compareObj.getHospital() == null)
			return false;
		if(this.getHospital() != null && compareObj.getHospital() != null)
			return this.getHospital().equals(compareObj.getHospital());
		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;
	
		AcuteTheatreListFilterVo clone = new AcuteTheatreListFilterVo();
		
		if(this.hospital == null)
			clone.hospital = null;
		else
			clone.hospital = (ims.core.vo.LocShortMappingsVo)this.hospital.clone();
		clone.listowner = this.listowner;
		if(this.sessiondate == null)
			clone.sessiondate = null;
		else
			clone.sessiondate = (ims.framework.utils.Date)this.sessiondate.clone();
		if(this.profile == null)
			clone.profile = null;
		else
			clone.profile = (ims.scheduling.vo.SessionShortVo)this.profile.clone();
		if(this.sessiontype == null)
			clone.sessiontype = null;
		else
			clone.sessiontype = (ims.scheduling.vo.lookups.TheatreType)this.sessiontype.clone();
		clone.wastimeron = this.wastimeron;
		if(this.listtype == null)
			clone.listtype = null;
		else
			clone.listtype = (ims.scheduling.vo.lookups.ProfileListType)this.listtype.clone();
		if(this.theatrelocation == null)
			clone.theatrelocation = null;
		else
			clone.theatrelocation = (ims.core.vo.LocShortMappingsVo)this.theatrelocation.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 (!(AcuteTheatreListFilterVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A AcuteTheatreListFilterVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		AcuteTheatreListFilterVo compareObj = (AcuteTheatreListFilterVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getHospital() == null && compareObj.getHospital() != null)
				return -1;
			if(this.getHospital() != null && compareObj.getHospital() == null)
				return 1;
			if(this.getHospital() != null && compareObj.getHospital() != null)
				retVal = this.getHospital().compareTo(compareObj.getHospital());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.hospital != null)
			count++;
		if(this.listowner != null)
			count++;
		if(this.sessiondate != null)
			count++;
		if(this.profile != null)
			count++;
		if(this.sessiontype != null)
			count++;
		if(this.wastimeron != null)
			count++;
		if(this.listtype != null)
			count++;
		if(this.theatrelocation != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected ims.core.vo.LocShortMappingsVo hospital;
	protected ims.core.resource.people.vo.HcpRefVo listowner;
	protected ims.framework.utils.Date sessiondate;
	protected ims.scheduling.vo.SessionShortVo profile;
	protected ims.scheduling.vo.lookups.TheatreType sessiontype;
	protected Boolean wastimeron;
	protected ims.scheduling.vo.lookups.ProfileListType listtype;
	protected ims.core.vo.LocShortMappingsVo theatrelocation;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
