// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5007.25751)
// Copyright (C) 1995-2014 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file

package ims.RefMan.vo;


public class SessionSlotCatsReferralClinicListWrapperVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public SessionSlotCatsReferralClinicListWrapperVo()
	{
	}
	public SessionSlotCatsReferralClinicListWrapperVo(ims.RefMan.vo.beans.SessionSlotCatsReferralClinicListWrapperVoBean bean)
	{
		this.slot = bean.getSlot() == null ? null : bean.getSlot().buildVo();
		this.referral = bean.getReferral() == null ? null : bean.getReferral().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.RefMan.vo.beans.SessionSlotCatsReferralClinicListWrapperVoBean bean)
	{
		this.slot = bean.getSlot() == null ? null : bean.getSlot().buildVo(map);
		this.referral = bean.getReferral() == null ? null : bean.getReferral().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.RefMan.vo.beans.SessionSlotCatsReferralClinicListWrapperVoBean bean = null;
		if(map != null)
			bean = (ims.RefMan.vo.beans.SessionSlotCatsReferralClinicListWrapperVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.RefMan.vo.beans.SessionSlotCatsReferralClinicListWrapperVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getSlotIsNotNull()
	{
		return this.slot != null;
	}
	public ims.scheduling.vo.SessionSlotClinicListListVo getSlot()
	{
		return this.slot;
	}
	public void setSlot(ims.scheduling.vo.SessionSlotClinicListListVo value)
	{
		this.isValidated = false;
		this.slot = value;
	}
	public boolean getReferralIsNotNull()
	{
		return this.referral != null;
	}
	public ims.RefMan.vo.CatsReferralClinicListListVo getReferral()
	{
		return this.referral;
	}
	public void setReferral(ims.RefMan.vo.CatsReferralClinicListListVo value)
	{
		this.isValidated = false;
		this.referral = 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 SessionSlotCatsReferralClinicListWrapperVo))
			return false;
		SessionSlotCatsReferralClinicListWrapperVo compareObj = (SessionSlotCatsReferralClinicListWrapperVo)obj;
		if(this.getSlot() == null && compareObj.getSlot() != null)
			return false;
		if(this.getSlot() != null && compareObj.getSlot() == null)
			return false;
		if(this.getSlot() != null && compareObj.getSlot() != null)
			return this.getSlot().equals(compareObj.getSlot());
		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;
	
		SessionSlotCatsReferralClinicListWrapperVo clone = new SessionSlotCatsReferralClinicListWrapperVo();
		
		if(this.slot == null)
			clone.slot = null;
		else
			clone.slot = (ims.scheduling.vo.SessionSlotClinicListListVo)this.slot.clone();
		if(this.referral == null)
			clone.referral = null;
		else
			clone.referral = (ims.RefMan.vo.CatsReferralClinicListListVo)this.referral.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 (!(SessionSlotCatsReferralClinicListWrapperVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A SessionSlotCatsReferralClinicListWrapperVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		SessionSlotCatsReferralClinicListWrapperVo compareObj = (SessionSlotCatsReferralClinicListWrapperVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getSlot() == null && compareObj.getSlot() != null)
				return -1;
			if(this.getSlot() != null && compareObj.getSlot() == null)
				return 1;
			if(this.getSlot() != null && compareObj.getSlot() != null)
				retVal = this.getSlot().compareTo(compareObj.getSlot());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.slot != null)
			count++;
		if(this.referral != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 2;
	}
	protected ims.scheduling.vo.SessionSlotClinicListListVo slot;
	protected ims.RefMan.vo.CatsReferralClinicListListVo referral;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
