gt: 		for(int x = 0; x < errorCount; x++)
context: //#############################################################################
  //#                                                                           #
  //#  Copyright (C) <2014>  <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/>.    #
  //#                                                                           #
  //#############################################################################
  //#EOH
  // 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.scheduling.vo;
  
  /**
   * Linked to Scheduling.Session_Slot business object (ID: 1055100016).
   */
  public class SessionSlotVo extends ims.scheduling.vo.SessionSlotLiteVo implements ims.vo.ImsCloneable, Comparable
  {
  	private static final long serialVersionUID = 1L;
  
  	public SessionSlotVo()
  	{
  	}
  	public SessionSlotVo(Integer id, int version)
  	{
  		super(id, version);
  	}
  	public SessionSlotVo(ims.scheduling.vo.beans.SessionSlotVoBean bean)
  	{
  		this.id = bean.getId();
  		this.version = bean.getVersion();
  		this.directoryofservices = ims.scheduling.vo.DirectoryOfServiceSessionSlotVoCollection.buildFromBeanCollection(bean.getDirectoryOfServices());
  		this.activity = bean.getActivity() == null ? null : bean.getActivity().buildVo();
  		this.starttm = bean.getStartTm() == null ? null : bean.getStartTm().buildTime();
  		this.duration = bean.getDuration();
  		this.priority = bean.getPriority() == null ? null : ims.scheduling.vo.lookups.SchedulingPriority.buildLookup(bean.getPriority());
  		this.isactive = bean.getIsActive();
  		this.directaccessslot = bean.getDirectAccessSlot() == null ? null : ims.scheduling.vo.lookups.SchedCABSlotType.buildLookup(bean.getDirectAccessSlot());
  		this.deallocdate = bean.getDeallocDate() == null ? null : bean.getDeallocDate().buildDate();
  		this.appointment = bean.getAppointment() == null ? null : bean.getAppointment().buildVo();
  		this.status = bean.getStatus() == null ? null : ims.scheduling.vo.lookups.Status_Reason.buildLookup(bean.getStatus());
  		this.statusreasonhistory = ims.scheduling.vo.SessionSlotStatusVoCollection.buildFromBeanCollection(bean.getStatusReasonHistory());
  		this.statusreason = bean.getStatusReason() == null ? null : ims.scheduling.vo.lookups.Status_Reason.buildLookup(bean.getStatusReason());
  		this.slotresp = bean.getSlotResp() == null ? null : bean.getSlotResp().buildVo();
  		this.session = bean.getSession() == null ? null : bean.getSession().buildVo();
  		this.sessdatetime = bean.getSessDateTime() == null ? null : bean.getSessDateTime().buildDateTime();
  	}
  	public void populate(ims.vo.ValueObjectBeanMap map, ims.scheduling.vo.beans.SessionSlotVoBean bean)
  	{
  		this.id = bean.getId();
  		this.version = bean.getVersion();
  		this.directoryofservices = ims.scheduling.vo.DirectoryOfServiceSessionSlotVoCollection.buildFromBeanCollection(bean.getDirectoryOfServices());
  		this.activity = bean.getActivity() == null ? null : bean.getActivity().buildVo(map);
  		this.starttm = bean.getStartTm() == null ? null : bean.getStartTm().buildTime();
  		this.duration = bean.getDuration();
  		this.priority = bean.getPriority() == null ? null : ims.scheduling.vo.lookups.SchedulingPriority.buildLookup(bean.getPriority());
  		this.isactive = bean.getIsActive();
  		this.directaccessslot = bean.getDirectAccessSlot() == null ? null : ims.scheduling.vo.lookups.SchedCABSlotType.buildLookup(bean.getDirectAccessSlot());
  		this.deallocdate = bean.getDeallocDate() == null ? null : bean.getDeallocDate().buildDate();
  		this.appointment = bean.getAppointment() == null ? null : bean.getAppointment().buildVo(map);
  		this.status = bean.getStatus() == null ? null : ims.scheduling.vo.lookups.Status_Reason.buildLookup(bean.getStatus());
  		this.statusreasonhistory = ims.scheduling.vo.SessionSlotStatusVoCollection.buildFromBeanCollection(bean.getStatusReasonHistory());
  		this.statusreason = bean.getStatusReason() == null ? null : ims.scheduling.vo.lookups.Status_Reason.buildLookup(bean.getStatusReason());
  		this.slotresp = bean.getSlotResp() == null ? null : bean.getSlotResp().buildVo(map);
  		this.session = bean.getSession() == null ? null : bean.getSession().buildVo(map);
  		this.sessdatetime = bean.getSessDateTime() == null ? null : bean.getSessDateTime().buildDateTime();
  	}
  	public ims.vo.ValueObjectBean getBean()
  	{
  		return this.getBean(new ims.vo.ValueObjectBeanMap());
  	}
  	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
  	{
  		ims.scheduling.vo.beans.SessionSlotVoBean bean = null;
  		if(map != null)
  			bean = (ims.scheduling.vo.beans.SessionSlotVoBean)map.getValueObjectBean(this);
  		if (bean == null)
  		{
  			bean = new ims.scheduling.vo.beans.SessionSlotVoBean();
  			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("ACTIVITY"))
  			return getActivity();
  		if(fieldName.equals("STARTTM"))
  			return getStartTm();
  		if(fieldName.equals("DURATION"))
  			return getDuration();
  		if(fieldName.equals("PRIORITY"))
  			return getPriority();
  		if(fieldName.equals("ISACTIVE"))
  			return getIsActive();
  		if(fieldName.equals("DIRECTACCESSSLOT"))
  			return getDirectAccessSlot();
  		if(fieldName.equals("DEALLOCDATE"))
  			return getDeallocDate();
  		if(fieldName.equals("APPOINTMENT"))
  			return getAppointment();
  		if(fieldName.equals("STATUS"))
  			return getStatus();
  		if(fieldName.equals("STATUSREASONHISTORY"))
  			return getStatusReasonHistory();
  		if(fieldName.equals("STATUSREASON"))
  			return getStatusReason();
  		if(fieldName.equals("SLOTRESP"))
  			return getSlotResp();
  		if(fieldName.equals("SESSION"))
  			return getSession();
  		if(fieldName.equals("SESSDATETIME"))
  			return getSessDateTime();
  		return super.getFieldValueByFieldName(fieldName);
  	}
  	public boolean getActivityIsNotNull()
  	{
  		return this.activity != null;
  	}
  	public ims.core.vo.ActivityVo getActivity()
  	{
  		return this.activity;
  	}
  	public void setActivity(ims.core.vo.ActivityVo value)
  	{
  		this.isValidated = false;
  		this.activity = value;
  	}
  	public boolean getStartTmIsNotNull()
  	{
  		return this.starttm != null;
  	}
  	public ims.framework.utils.Time getStartTm()
  	{
  		return this.starttm;
  	}
  	public void setStartTm(ims.framework.utils.Time value)
  	{
  		this.isValidated = false;
  		this.starttm = value;
  	}
  	public boolean getDurationIsNotNull()
  	{
  		return this.duration != null;
  	}
  	public Integer getDuration()
  	{
  		return this.duration;
  	}
  	public void setDuration(Integer value)
  	{
  		this.isValidated = false;
  		this.duration = value;
  	}
  	public boolean getPriorityIsNotNull()
  	{
  		return this.priority != null;
  	}
  	public ims.scheduling.vo.lookups.SchedulingPriority getPriority()
  	{
  		return this.priority;
  	}
  	public void setPriority(ims.scheduling.vo.lookups.SchedulingPriority value)
  	{
  		this.isValidated = false;
  		this.priority = value;
  	}
  	public boolean getIsActiveIsNotNull()
  	{
  		return this.isactive != null;
  	}
  	public Boolean getIsActive()
  	{
  		return this.isactive;
  	}
  	public void setIsActive(Boolean value)
  	{
  		this.isValidated = false;
  		this.isactive = value;
  	}
  	public boolean getDirectAccessSlotIsNotNull()
  	{
  		return this.directaccessslot != null;
  	}
  	public ims.scheduling.vo.lookups.SchedCABSlotType getDirectAccessSlot()
  	{
  		return this.directaccessslot;
  	}
  	public void setDirectAccessSlot(ims.scheduling.vo.lookups.SchedCABSlotType value)
  	{
  		this.isValidated = false;
  		this.directaccessslot = value;
  	}
  	public boolean getDeallocDateIsNotNull()
  	{
  		return this.deallocdate != null;
  	}
  	public ims.framework.utils.Date getDeallocDate()
  	{
  		return this.deallocdate;
  	}
  	public void setDeallocDate(ims.framework.utils.Date value)
  	{
  		this.isValidated = false;
  		this.deallocdate = value;
  	}
  	public boolean getAppointmentIsNotNull()
  	{
  		return this.appointment != null;
  	}
  	public ims.scheduling.vo.Booking_AppointmentVo getAppointment()
  	{
  		return this.appointment;
  	}
  	public void setAppointment(ims.scheduling.vo.Booking_AppointmentVo value)
  	{
  		this.isValidated = false;
  		this.appointment = value;
  	}
  	public boolean getStatusIsNotNull()
  	{
  		return this.status != null;
  	}
  	public ims.scheduling.vo.lookups.Status_Reason getStatus()
  	{
  		return this.status;
  	}
  	public void setStatus(ims.scheduling.vo.lookups.Status_Reason value)
  	{
  		this.isValidated = false;
  		this.status = value;
  	}
  	public boolean getStatusReasonHistoryIsNotNull()
  	{
  		return this.statusreasonhistory != null;
  	}
  	public ims.scheduling.vo.SessionSlotStatusVoCollection getStatusReasonHistory()
  	{
  		return this.statusreasonhistory;
  	}
  	public void setStatusReasonHistory(ims.scheduling.vo.SessionSlotStatusVoCollection value)
  	{
  		this.isValidated = false;
  		this.statusreasonhistory = value;
  	}
  	public boolean getStatusReasonIsNotNull()
  	{
  		return this.statusreason != null;
  	}
  	public ims.scheduling.vo.lookups.Status_Reason getStatusReason()
  	{
  		return this.statusreason;
  	}
  	public void setStatusReason(ims.scheduling.vo.lookups.Status_Reason value)
  	{
  		this.isValidated = false;
  		this.statusreason = value;
  	}
  	public boolean getSlotRespIsNotNull()
  	{
  		return this.slotresp != null;
  	}
  	public ims.scheduling.vo.Session_ListOwnerVo getSlotResp()
  	{
  		return this.slotresp;
  	}
  	public void setSlotResp(ims.scheduling.vo.Session_ListOwnerVo value)
  	{
  		this.isValidated = false;
  		this.slotresp = value;
  	}
  	public boolean getSessionIsNotNull()
  	{
  		return this.session != null;
  	}
  	public ims.scheduling.vo.SessionIntermediateVo getSession()
  	{
  		return this.session;
  	}
  	public void setSession(ims.scheduling.vo.SessionIntermediateVo value)
  	{
  		this.isValidated = false;
  		this.session = value;
  	}
  	public boolean getSessDateTimeIsNotNull()
  	{
  		return this.sessdatetime != null;
  	}
  	public ims.framework.utils.DateTime getSessDateTime()
  	{
  		return this.sessdatetime;
  	}
  	public void setSessDateTime(ims.framework.utils.DateTime value)
  	{
  		this.isValidated = false;
  		this.sessdatetime = value;
  	}
  	/**
  	* getDOSVoFromUSRN(String usrn) : Returns the DirectoryOfServiceSessionSlotVo for the given USRN
  	*/
  	public DirectoryOfServiceSessionSlotVo getDOSVoFromUSRN(String usrn)
  		{
  			// Loop Through the DirectoryOfServiceSessionSlotVoCollection and get the
  			// correct one matching this usrn
  			for (int i=0; i<directoryofservices.size(); i++)
  			{
  				DirectoryOfServiceSessionSlotVo vo = directoryofservices.get(i);
  				if (vo.getUSRN().equals(usrn))
  					return vo;
  			}
  			return null;
  		}
  	/**
  	* getDOSVoFromUBRN(String ubrn) : Returns the DirectoryOfServiceSessionSlotVo for the given UBRN
  	*/
  		public DirectoryOfServiceSessionSlotVo getDOSVoFromUBRN(String ubrn)
  		{
  			// Loop Through the DirectoryOfServiceSessionSlotVoCollection and get the
  			// correct one matching this usrn
  			for (int i=0; i<directoryofservices.size(); i++)
  			{
  				DirectoryOfServiceSessionSlotVo vo = directoryofservices.get(i);
  				if (vo.getUBRN().equals(ubrn))
  					return vo;
  			}
  			return null;
  		}
  	/**
  	* getActualDirectoryOfService() : Returns the DirectoryOfService that is currently marked as booked for the appointment
  	*/
  		public DirectoryOfServiceLiteVo getActualDirectoryOfService() 
  		{
  			// Get the actual directory of Service that is used for the appointment from the slot
  			// This will loop through the DirectoryOfService details to find where ubrn is not null
  			for (int i=0; i<directoryofservices.size(); i++)
  			{
  				DirectoryOfServiceSessionSlotVo vo = directoryofservices.get(i);
  				if (vo.getUBRN() != null)
  					return vo.getDirectoryOfService();
  			}
  			return null;
  		}
  	/**
  	* getUBRN() : Returns the ubrn that is populated : ie booked for the appoinment
  	*/
  	public String getUBRN() 
  	{
  		// Return the ubrn for this slot - it can be found in the directoryofServices collection
  		if(this.directoryofservices != null)
  		{
  			for(int i=0;i<this.directoryofservices.size(); i++)
  			{
  				if(this.directoryofservices.get(i).ubrn != null)
  					return this.directoryofservices.get(i).ubrn;
  			}
  		}
  	
  		return null;
  	}
  	/**
  	* Set the UBRN for the directory of service record with the given USRN
  	*/
  	public void setUBRNforUSRN(String usrn, String ubrn) 
  			{
  				//	Loop Through the DirectoryOfServiceSessionSlotVoCollection and get the
  				// correct one matching this usrn, update the ubrn value for that slot
  				for (int i=0; i<directoryofservices.size(); i++)
  				{
  					DirectoryOfServiceSessionSlotVo vo = directoryofservices.get(i);
  					if (vo.getUSRN().equals(usrn))
  					{
  						vo.setUBRN(ubrn);
  						return;
  					}
  						
  				}
  				
  			}
  	public boolean isValidated()
  	{
  		if(this.isBusy)
  			return true;
  		this.isBusy = true;
  	
  		if(!this.isValidated)
  		{
  			this.isBusy = false;
  			return false;
  		}
  		if(this.directoryofservices != null)
  		{
  			if(!this.directoryofservices.isValidated())
  			{
  				this.isBusy = false;
  				return false;
  			}
  		}
  		if(this.activity != null)
  		{
  			if(!this.activity.isValidated())
  			{
  				this.isBusy = false;
  				return false;
  			}
  		}
  		if(this.appointment != null)
  		{
  			if(!this.appointment.isValidated())
  			{
  				this.isBusy = false;
  				return false;
  			}
  		}
  		if(this.statusreasonhistory != null)
  		{
  			if(!this.statusreasonhistory.isValidated())
  			{
  				this.isBusy = false;
  				return false;
  			}
  		}
  		if(this.slotresp != null)
  		{
  			if(!this.slotresp.isValidated())
  			{
  				this.isBusy = false;
  				return false;
  			}
  		}
  		if(this.session != null)
  		{
  			if(!this.session.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]);
  			}
  		}
  		if(this.directoryofservices != null)
  		{
  			String[] listOfOtherErrors = this.directoryofservices.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		if(this.activity != null)
  		{
  			String[] listOfOtherErrors = this.activity.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		if(this.priority == null)
  			listOfErrors.add("Priority is mandatory");
  		if(this.appointment != null)
  		{
  			String[] listOfOtherErrors = this.appointment.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		if(this.status == null)
  			listOfErrors.add("Status is mandatory");
  		if(this.statusreasonhistory != null)
  		{
  			String[] listOfOtherErrors = this.statusreasonhistory.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		if(this.slotresp != null)
  		{
  			String[] listOfOtherErrors = this.slotresp.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		if(this.session != null)
  		{
  			String[] listOfOtherErrors = this.session.validate();
  			if(listOfOtherErrors != null)
  			{
  				for(int x = 0; x < listOfOtherErrors.length; x++)
  				{
  					listOfErrors.add(listOfOtherErrors[x]);
  				}
  			}
  		}
  		int errorCount = listOfErrors.size();
  		if(errorCount == 0)
  		{
  			this.isBusy = false;
  			this.isValidated = true;
  			return null;
  		}
  		String[] result = new String[errorCount];
  