/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/dtomove/vo/ifApptDetailsVo.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.dtomove.vo;

/**
 * Linked to dto_move.AppointmentDetail business object (ID: 1105100032).
 */
public class ifApptDetailsVo extends ims.dto_move.vo.AppointmentDetailRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public ifApptDetailsVo()
	{
	}
	public ifApptDetailsVo(Integer id, int version)
	{
		super(id, version);
	}
	public ifApptDetailsVo(ims.dtomove.vo.beans.ifApptDetailsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.apptdate = bean.getApptDate() == null ? null : bean.getApptDate().buildDate();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo();
		this.mos = bean.getMos() == null ? null : bean.getMos().buildVo();
		this.starttime = bean.getStartTime() == null ? null : bean.getStartTime().buildTime();
		this.endtime = bean.getEndTime() == null ? null : bean.getEndTime().buildTime();
		this.priority = bean.getPriority() == null ? null : ims.ccosched.vo.lookups.Priority.buildLookup(bean.getPriority());
		this.session = bean.getSession() == null ? null : new ims.dto_move.vo.SessionRefVo(new Integer(bean.getSession().getId()), bean.getSession().getVersion());
		this.apptstatus = bean.getApptStatus() == null ? null : ims.ccosched.vo.lookups.AppointmentStatus.buildLookup(bean.getApptStatus());
		this.activityname = bean.getActivityName();
		this.apptstart = bean.getApptStart();
		this.apptend = bean.getApptEnd();
		this.profilename = bean.getProfileName();
		this.activitycode = bean.getActivityCode();
		this.locationname = bean.getLocationName();
		this.machinename = bean.getMachineName();
		this.apptstatusstring = bean.getApptStatusString();
		this.activitygroupname = bean.getActivityGroupName();
		this.bookingmos = bean.getBookingMos() == null ? null : bean.getBookingMos().buildVo();
		this.facilityname = bean.getFacilityName();
		this.consultantmos = bean.getConsultantMos() == null ? null : bean.getConsultantMos().buildVo();
		this.patientstatus = bean.getPatientStatus() == null ? null : ims.ccosched.vo.lookups.Status.buildLookup(bean.getPatientStatus());
		this.firstapptindicator = bean.getFirstApptIndicator() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getFirstApptIndicator());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.dtomove.vo.beans.ifApptDetailsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.apptdate = bean.getApptDate() == null ? null : bean.getApptDate().buildDate();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo(map);
		this.mos = bean.getMos() == null ? null : bean.getMos().buildVo(map);
		this.starttime = bean.getStartTime() == null ? null : bean.getStartTime().buildTime();
		this.endtime = bean.getEndTime() == null ? null : bean.getEndTime().buildTime();
		this.priority = bean.getPriority() == null ? null : ims.ccosched.vo.lookups.Priority.buildLookup(bean.getPriority());
		this.session = bean.getSession() == null ? null : new ims.dto_move.vo.SessionRefVo(new Integer(bean.getSession().getId()), bean.getSession().getVersion());
		this.apptstatus = bean.getApptStatus() == null ? null : ims.ccosched.vo.lookups.AppointmentStatus.buildLookup(bean.getApptStatus());
		this.activityname = bean.getActivityName();
		this.apptstart = bean.getApptStart();
		this.apptend = bean.getApptEnd();
		this.profilename = bean.getProfileName();
		this.activitycode = bean.getActivityCode();
		this.locationname = bean.getLocationName();
		this.machinename = bean.getMachineName();
		this.apptstatusstring = bean.getApptStatusString();
		this.activitygroupname = bean.getActivityGroupName();
		this.bookingmos = bean.getBookingMos() == null ? null : bean.getBookingMos().buildVo(map);
		this.facilityname = bean.getFacilityName();
		this.consultantmos = bean.getConsultantMos() == null ? null : bean.getConsultantMos().buildVo(map);
		this.patientstatus = bean.getPatientStatus() == null ? null : ims.ccosched.vo.lookups.Status.buildLookup(bean.getPatientStatus());
		this.firstapptindicator = bean.getFirstApptIndicator() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getFirstApptIndicator());
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.dtomove.vo.beans.ifApptDetailsVoBean bean = null;
		if(map != null)
			bean = (ims.dtomove.vo.beans.ifApptDetailsVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.dtomove.vo.beans.ifApptDetailsVoBean();
			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("APPTDATE"))
			return getApptDate();
		if(fieldName.equals("PATIENT"))
			return getPatient();
		if(fieldName.equals("MOS"))
			return getMos();
		if(fieldName.equals("STARTTIME"))
			return getStartTime();
		if(fieldName.equals("ENDTIME"))
			return getEndTime();
		if(fieldName.equals("PRIORITY"))
			return getPriority();
		if(fieldName.equals("SESSION"))
			return getSession();
		if(fieldName.equals("APPTSTATUS"))
			return getApptStatus();
		if(fieldName.equals("ACTIVITYNAME"))
			return getActivityName();
		if(fieldName.equals("APPTSTART"))
			return getApptStart();
		if(fieldName.equals("APPTEND"))
			return getApptEnd();
		if(fieldName.equals("PROFILENAME"))
			return getProfileName();
		if(fieldName.equals("ACTIVITYCODE"))
			return getActivityCode();
		if(fieldName.equals("LOCATIONNAME"))
			return getLocationName();
		if(fieldName.equals("MACHINENAME"))
			return getMachineName();
		if(fieldName.equals("APPTSTATUSSTRING"))
			return getApptStatusString();
		if(fieldName.equals("ACTIVITYGROUPNAME"))
			return getActivityGroupName();
		if(fieldName.equals("BOOKINGMOS"))
			return getBookingMos();
		if(fieldName.equals("FACILITYNAME"))
			return getFacilityName();
		if(fieldName.equals("CONSULTANTMOS"))
			return getConsultantMos();
		if(fieldName.equals("PATIENTSTATUS"))
			return getPatientStatus();
		if(fieldName.equals("FIRSTAPPTINDICATOR"))
			return getFirstApptIndicator();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getApptDateIsNotNull()
	{
		return this.apptdate != null;
	}
	public ims.framework.utils.Date getApptDate()
	{
		return this.apptdate;
	}
	public void setApptDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.apptdate = value;
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.vo.Patient getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.vo.Patient value)
	{
		this.isValidated = false;
		this.patient = value;
	}
	public boolean getMosIsNotNull()
	{
		return this.mos != null;
	}
	public ims.core.vo.MemberOfStaffShortVo getMos()
	{
		return this.mos;
	}
	public void setMos(ims.core.vo.MemberOfStaffShortVo value)
	{
		this.isValidated = false;
		this.mos = value;
	}
	public boolean getStartTimeIsNotNull()
	{
		return this.starttime != null;
	}
	public ims.framework.utils.Time getStartTime()
	{
		return this.starttime;
	}
	public void setStartTime(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.starttime = value;
	}
	public boolean getEndTimeIsNotNull()
	{
		return this.endtime != null;
	}
	public ims.framework.utils.Time getEndTime()
	{
		return this.endtime;
	}
	public void setEndTime(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.endtime = value;
	}
	public boolean getPriorityIsNotNull()
	{
		return this.priority != null;
	}
	public ims.ccosched.vo.lookups.Priority getPriority()
	{
		return this.priority;
	}
	public void setPriority(ims.ccosched.vo.lookups.Priority value)
	{
		this.isValidated = false;
		this.priority = value;
	}
	public boolean getSessionIsNotNull()
	{
		return this.session != null;
	}
	public ims.dto_move.vo.SessionRefVo getSession()
	{
		return this.session;
	}
	public void setSession(ims.dto_move.vo.SessionRefVo value)
	{
		this.isValidated = false;
		this.session = value;
	}
	public boolean getApptStatusIsNotNull()
	{
		return this.apptstatus != null;
	}
	public ims.ccosched.vo.lookups.AppointmentStatus getApptStatus()
	{
		return this.apptstatus;
	}
	public void setApptStatus(ims.ccosched.vo.lookups.AppointmentStatus value)
	{
		this.isValidated = false;
		this.apptstatus = value;
	}
	public boolean getActivityNameIsNotNull()
	{
		return this.activityname != null;
	}
	public String getActivityName()
	{
		return this.activityname;
	}
	public static int getActivityNameMaxLength()
	{
		return 255;
	}
	public void setActivityName(String value)
	{
		this.isValidated = false;
		this.activityname = value;
	}
	public boolean getApptStartIsNotNull()
	{
		return this.apptstart != null;
	}
	public String getApptStart()
	{
		return this.apptstart;
	}
	public static int getApptStartMaxLength()
	{
		return 255;
	}
	public void setApptStart(String value)
	{
		this.isValidated = false;
		this.apptstart = value;
	}
	public boolean getApptEndIsNotNull()
	{
		return this.apptend != null;
	}
	public String getApptEnd()
	{
		return this.apptend;
	}
	public static int getApptEndMaxLength()
	{
		return 255;
	}
	public void setApptEnd(String value)
	{
		this.isValidated = false;
		this.apptend = value;
	}
	public boolean getProfileNameIsNotNull()
	{
		return this.profilename != null;
	}
	public String getProfileName()
	{
		return this.profilename;
	}
	public static int getProfileNameMaxLength()
	{
		return 255;
	}
	public void setProfileName(String value)
	{
		this.isValidated = false;
		this.profilename = value;
	}
	public boolean getActivityCodeIsNotNull()
	{
		return this.activitycode != null;
	}
	public String getActivityCode()
	{
		return this.activitycode;
	}
	public static int getActivityCodeMaxLength()
	{
		return 255;
	}
	public void setActivityCode(String value)
	{
		this.isValidated = false;
		this.activitycode = value;
	}
	public boolean getLocationNameIsNotNull()
	{
		return this.locationname != null;
	}
	public String getLocationName()
	{
		return this.locationname;
	}
	public static int getLocationNameMaxLength()
	{
		return 255;
	}
	public void setLocationName(String value)
	{
		this.isValidated = false;
		this.locationname = value;
	}
	public boolean getMachineNameIsNotNull()
	{
		return this.machinename != null;
	}
	public String getMachineName()
	{
		return this.machinename;
	}
	public static int getMachineNameMaxLength()
	{
		return 255;
	}
	public void setMachineName(String value)
	{
		this.isValidated = false;
		this.machinename = value;
	}
	public boolean getApptStatusStringIsNotNull()
	{
		return this.apptstatusstring != null;
	}
	public String getApptStatusString()
	{
		return this.apptstatusstring;
	}
	public static int getApptStatusStringMaxLength()
	{
		return 255;
	}
	public void setApptStatusString(String value)
	{
		this.isValidated = false;
		this.apptstatusstring = value;
	}
	public boolean getActivityGroupNameIsNotNull()
	{
		return this.activitygroupname != null;
	}
	public String getActivityGroupName()
	{
		return this.activitygroupname;
	}
	public static int getActivityGroupNameMaxLength()
	{
		return 255;
	}
	public void setActivityGroupName(String value)
	{
		this.isValidated = false;
		this.activitygroupname = value;
	}
	public boolean getBookingMosIsNotNull()
	{
		return this.bookingmos != null;
	}
	public ims.core.vo.MemberOfStaffShortVo getBookingMos()
	{
		return this.bookingmos;
	}
	public void setBookingMos(ims.core.vo.MemberOfStaffShortVo value)
	{
		this.isValidated = false;
		this.bookingmos = value;
	}
	public boolean getFacilityNameIsNotNull()
	{
		return this.facilityname != null;
	}
	public String getFacilityName()
	{
		return this.facilityname;
	}
	public static int getFacilityNameMaxLength()
	{
		return 255;
	}
	public void setFacilityName(String value)
	{
		this.isValidated = false;
		this.facilityname = value;
	}
	public boolean getConsultantMosIsNotNull()
	{
		return this.consultantmos != null;
	}
	public ims.core.vo.MemberOfStaffShortVo getConsultantMos()
	{
		return this.consultantmos;
	}
	public void setConsultantMos(ims.core.vo.MemberOfStaffShortVo value)
	{
		this.isValidated = false;
		this.consultantmos = value;
	}
	public boolean getPatientStatusIsNotNull()
	{
		return this.patientstatus != null;
	}
	public ims.ccosched.vo.lookups.Status getPatientStatus()
	{
		return this.patientstatus;
	}
	public void setPatientStatus(ims.ccosched.vo.lookups.Status value)
	{
		this.isValidated = false;
		this.patientstatus = value;
	}
	public boolean getFirstApptIndicatorIsNotNull()
	{
		return this.firstapptindicator != null;
	}
	public ims.core.vo.lookups.YesNo getFirstApptIndicator()
	{
		return this.firstapptindicator;
	}
	public void setFirstApptIndicator(ims.core.vo.lookups.YesNo value)
	{
		this.isValidated = false;
		this.firstapptindicator = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.patient != null)
		{
			if(!this.patient.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.mos != null)
		{
			if(!this.mos.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.patient != null)
		{
			String[] listOfOtherErrors = this.patient.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.mos != null)
		{
			String[] listOfOtherErrors = this.mos.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];
		for(int x = 0; x < errorCount; x++)
			result[x] = (String)listOfErrors.get(x);
		this.isBusy = false;
		this.isValidated = false;
		return result;
	}
	public void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		ifApptDetailsVo clone = new ifApptDetailsVo(this.id, this.version);
		
		if(this.apptdate == null)
			clone.apptdate = null;
		else
			clone.apptdate = (ims.framework.utils.Date)this.apptdate.clone();
		if(this.patient == null)
			clone.patient = null;
		else
			clone.patient = (ims.core.vo.Patient)this.patient.clone();
		if(this.mos == null)
			clone.mos = null;
		else
			clone.mos = (ims.core.vo.MemberOfStaffShortVo)this.mos.clone();
		if(this.starttime == null)
			clone.starttime = null;
		else
			clone.starttime = (ims.framework.utils.Time)this.starttime.clone();
		if(this.endtime == null)
			clone.endtime = null;
		else
			clone.endtime = (ims.framework.utils.Time)this.endtime.clone();
		if(this.priority == null)
			clone.priority = null;
		else
			clone.priority = (ims.ccosched.vo.lookups.Priority)this.priority.clone();
		clone.session = this.session;
		if(this.apptstatus == null)
			clone.apptstatus = null;
		else
			clone.apptstatus = (ims.ccosched.vo.lookups.AppointmentStatus)this.apptstatus.clone();
		clone.activityname = this.activityname;
		clone.apptstart = this.apptstart;
		clone.apptend = this.apptend;
		clone.profilename = this.profilename;
		clone.activitycode = this.activitycode;
		clone.locationname = this.locationname;
		clone.machinename = this.machinename;
		clone.apptstatusstring = this.apptstatusstring;
		clone.activitygroupname = this.activitygroupname;
		if(this.bookingmos == null)
			clone.bookingmos = null;
		else
			clone.bookingmos = (ims.core.vo.MemberOfStaffShortVo)this.bookingmos.clone();
		clone.facilityname = this.facilityname;
		if(this.consultantmos == null)
			clone.consultantmos = null;
		else
			clone.consultantmos = (ims.core.vo.MemberOfStaffShortVo)this.consultantmos.clone();
		if(this.patientstatus == null)
			clone.patientstatus = null;
		else
			clone.patientstatus = (ims.ccosched.vo.lookups.Status)this.patientstatus.clone();
		if(this.firstapptindicator == null)
			clone.firstapptindicator = null;
		else
			clone.firstapptindicator = (ims.core.vo.lookups.YesNo)this.firstapptindicator.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 (!(ifApptDetailsVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ifApptDetailsVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((ifApptDetailsVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((ifApptDetailsVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.apptdate != null)
			count++;
		if(this.patient != null)
			count++;
		if(this.mos != null)
			count++;
		if(this.starttime != null)
			count++;
		if(this.endtime != null)
			count++;
		if(this.priority != null)
			count++;
		if(this.session != null)
			count++;
		if(this.apptstatus != null)
			count++;
		if(this.activityname != null)
			count++;
		if(this.apptstart != null)
			count++;
		if(this.apptend != null)
			count++;
		if(this.profilename != null)
			count++;
		if(this.activitycode != null)
			count++;
		if(this.locationname != null)
			count++;
		if(this.machinename != null)
			count++;
		if(this.apptstatusstring != null)
			count++;
		if(this.activitygroupname != null)
			count++;
		if(this.bookingmos != null)
			count++;
		if(this.facilityname != null)
			count++;
		if(this.consultantmos != null)
			count++;
		if(this.patientstatus != null)
			count++;
		if(this.firstapptindicator != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 22;
	}
	protected ims.framework.utils.Date apptdate;
	protected ims.core.vo.Patient patient;
	protected ims.core.vo.MemberOfStaffShortVo mos;
	protected ims.framework.utils.Time starttime;
	protected ims.framework.utils.Time endtime;
	protected ims.ccosched.vo.lookups.Priority priority;
	protected ims.dto_move.vo.SessionRefVo session;
	protected ims.ccosched.vo.lookups.AppointmentStatus apptstatus;
	protected String activityname;
	protected String apptstart;
	protected String apptend;
	protected String profilename;
	protected String activitycode;
	protected String locationname;
	protected String machinename;
	protected String apptstatusstring;
	protected String activitygroupname;
	protected ims.core.vo.MemberOfStaffShortVo bookingmos;
	protected String facilityname;
	protected ims.core.vo.MemberOfStaffShortVo consultantmos;
	protected ims.ccosched.vo.lookups.Status patientstatus;
	protected ims.core.vo.lookups.YesNo firstapptindicator;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
