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

/**
 * Linked to RefMan.PatientElectiveList business object (ID: 1014100020).
 */
public class PatientElectiveListForPendingAdmissionVo extends ims.RefMan.vo.PatientElectiveListRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PatientElectiveListForPendingAdmissionVo()
	{
	}
	public PatientElectiveListForPendingAdmissionVo(Integer id, int version)
	{
		super(id, version);
	}
	public PatientElectiveListForPendingAdmissionVo(ims.RefMan.vo.beans.PatientElectiveListForPendingAdmissionVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.electivelist = bean.getElectiveList() == null ? null : bean.getElectiveList().buildVo();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo();
		this.electiveadmissiontype = bean.getElectiveAdmissionType() == null ? null : ims.RefMan.vo.lookups.ElectiveAdmissionType.buildLookup(bean.getElectiveAdmissionType());
		this.tcidetails = bean.getTCIDetails() == null ? null : bean.getTCIDetails().buildVo();
		this.primaryprocedure = bean.getPrimaryProcedure() == null ? null : bean.getPrimaryProcedure().buildVo();
		this.patienthasactivealerts = bean.getPatientHasActiveAlerts();
		this.wardstatus = bean.getWardStatus() == null ? null : ims.core.vo.lookups.WardBayStatus.buildLookup(bean.getWardStatus());
		this.comments = bean.getComments();
		this.referral = bean.getReferral() == null ? null : new ims.RefMan.vo.CatsReferralRefVo(new Integer(bean.getReferral().getId()), bean.getReferral().getVersion());
		this.preassessmentoutcome = bean.getPreAssessmentOutcome() == null ? null : bean.getPreAssessmentOutcome().buildVo();
		this.responsiblehcp = bean.getResponsibleHCP() == null ? null : bean.getResponsibleHCP().buildVo();
		this.noofpreoperativenights = bean.getNoOfPreOperativeNights();
		this.anticipatedstay = bean.getAnticipatedStay();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.RefMan.vo.beans.PatientElectiveListForPendingAdmissionVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.electivelist = bean.getElectiveList() == null ? null : bean.getElectiveList().buildVo(map);
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo(map);
		this.electiveadmissiontype = bean.getElectiveAdmissionType() == null ? null : ims.RefMan.vo.lookups.ElectiveAdmissionType.buildLookup(bean.getElectiveAdmissionType());
		this.tcidetails = bean.getTCIDetails() == null ? null : bean.getTCIDetails().buildVo(map);
		this.primaryprocedure = bean.getPrimaryProcedure() == null ? null : bean.getPrimaryProcedure().buildVo(map);
		this.patienthasactivealerts = bean.getPatientHasActiveAlerts();
		this.wardstatus = bean.getWardStatus() == null ? null : ims.core.vo.lookups.WardBayStatus.buildLookup(bean.getWardStatus());
		this.comments = bean.getComments();
		this.referral = bean.getReferral() == null ? null : new ims.RefMan.vo.CatsReferralRefVo(new Integer(bean.getReferral().getId()), bean.getReferral().getVersion());
		this.preassessmentoutcome = bean.getPreAssessmentOutcome() == null ? null : bean.getPreAssessmentOutcome().buildVo(map);
		this.responsiblehcp = bean.getResponsibleHCP() == null ? null : bean.getResponsibleHCP().buildVo(map);
		this.noofpreoperativenights = bean.getNoOfPreOperativeNights();
		this.anticipatedstay = bean.getAnticipatedStay();
	}
	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.PatientElectiveListForPendingAdmissionVoBean bean = null;
		if(map != null)
			bean = (ims.RefMan.vo.beans.PatientElectiveListForPendingAdmissionVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.RefMan.vo.beans.PatientElectiveListForPendingAdmissionVoBean();
			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("ELECTIVELIST"))
			return getElectiveList();
		if(fieldName.equals("PATIENT"))
			return getPatient();
		if(fieldName.equals("ELECTIVEADMISSIONTYPE"))
			return getElectiveAdmissionType();
		if(fieldName.equals("TCIDETAILS"))
			return getTCIDetails();
		if(fieldName.equals("PRIMARYPROCEDURE"))
			return getPrimaryProcedure();
		if(fieldName.equals("PATIENTHASACTIVEALERTS"))
			return getPatientHasActiveAlerts();
		if(fieldName.equals("WARDSTATUS"))
			return getWardStatus();
		if(fieldName.equals("COMMENTS"))
			return getComments();
		if(fieldName.equals("REFERRAL"))
			return getReferral();
		if(fieldName.equals("PREASSESSMENTOUTCOME"))
			return getPreAssessmentOutcome();
		if(fieldName.equals("RESPONSIBLEHCP"))
			return getResponsibleHCP();
		if(fieldName.equals("NOOFPREOPERATIVENIGHTS"))
			return getNoOfPreOperativeNights();
		if(fieldName.equals("ANTICIPATEDSTAY"))
			return getAnticipatedStay();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getElectiveListIsNotNull()
	{
		return this.electivelist != null;
	}
	public ims.RefMan.vo.ElectiveListConfigurationLiteVo getElectiveList()
	{
		return this.electivelist;
	}
	public void setElectiveList(ims.RefMan.vo.ElectiveListConfigurationLiteVo value)
	{
		this.isValidated = false;
		this.electivelist = value;
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.vo.PatientShortListVo getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.vo.PatientShortListVo value)
	{
		this.isValidated = false;
		this.patient = value;
	}
	public boolean getElectiveAdmissionTypeIsNotNull()
	{
		return this.electiveadmissiontype != null;
	}
	public ims.RefMan.vo.lookups.ElectiveAdmissionType getElectiveAdmissionType()
	{
		return this.electiveadmissiontype;
	}
	public void setElectiveAdmissionType(ims.RefMan.vo.lookups.ElectiveAdmissionType value)
	{
		this.isValidated = false;
		this.electiveadmissiontype = value;
	}
	public boolean getTCIDetailsIsNotNull()
	{
		return this.tcidetails != null;
	}
	public ims.RefMan.vo.PatientElectiveTCIBedManagerCommentVo getTCIDetails()
	{
		return this.tcidetails;
	}
	public void setTCIDetails(ims.RefMan.vo.PatientElectiveTCIBedManagerCommentVo value)
	{
		this.isValidated = false;
		this.tcidetails = value;
	}
	public boolean getPrimaryProcedureIsNotNull()
	{
		return this.primaryprocedure != null;
	}
	public ims.core.vo.ProcedureLiteVo getPrimaryProcedure()
	{
		return this.primaryprocedure;
	}
	public void setPrimaryProcedure(ims.core.vo.ProcedureLiteVo value)
	{
		this.isValidated = false;
		this.primaryprocedure = value;
	}
	public boolean getPatientHasActiveAlertsIsNotNull()
	{
		return this.patienthasactivealerts != null;
	}
	public Boolean getPatientHasActiveAlerts()
	{
		return this.patienthasactivealerts;
	}
	public void setPatientHasActiveAlerts(Boolean value)
	{
		this.isValidated = false;
		this.patienthasactivealerts = value;
	}
	public boolean getWardStatusIsNotNull()
	{
		return this.wardstatus != null;
	}
	public ims.core.vo.lookups.WardBayStatus getWardStatus()
	{
		return this.wardstatus;
	}
	public void setWardStatus(ims.core.vo.lookups.WardBayStatus value)
	{
		this.isValidated = false;
		this.wardstatus = value;
	}
	public boolean getCommentsIsNotNull()
	{
		return this.comments != null;
	}
	public String getComments()
	{
		return this.comments;
	}
	public static int getCommentsMaxLength()
	{
		return 255;
	}
	public void setComments(String value)
	{
		this.isValidated = false;
		this.comments = value;
	}
	public boolean getReferralIsNotNull()
	{
		return this.referral != null;
	}
	public ims.RefMan.vo.CatsReferralRefVo getReferral()
	{
		return this.referral;
	}
	public void setReferral(ims.RefMan.vo.CatsReferralRefVo value)
	{
		this.isValidated = false;
		this.referral = value;
	}
	public boolean getPreAssessmentOutcomeIsNotNull()
	{
		return this.preassessmentoutcome != null;
	}
	public ims.RefMan.vo.PreAssessmentOutcomeCommentsForPatElListVo getPreAssessmentOutcome()
	{
		return this.preassessmentoutcome;
	}
	public void setPreAssessmentOutcome(ims.RefMan.vo.PreAssessmentOutcomeCommentsForPatElListVo value)
	{
		this.isValidated = false;
		this.preassessmentoutcome = value;
	}
	public boolean getResponsibleHCPIsNotNull()
	{
		return this.responsiblehcp != null;
	}
	public ims.core.vo.HcpLiteVo getResponsibleHCP()
	{
		return this.responsiblehcp;
	}
	public void setResponsibleHCP(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.responsiblehcp = value;
	}
	public boolean getNoOfPreOperativeNightsIsNotNull()
	{
		return this.noofpreoperativenights != null;
	}
	public Integer getNoOfPreOperativeNights()
	{
		return this.noofpreoperativenights;
	}
	public void setNoOfPreOperativeNights(Integer value)
	{
		this.isValidated = false;
		this.noofpreoperativenights = value;
	}
	public boolean getAnticipatedStayIsNotNull()
	{
		return this.anticipatedstay != null;
	}
	public Integer getAnticipatedStay()
	{
		return this.anticipatedstay;
	}
	public void setAnticipatedStay(Integer value)
	{
		this.isValidated = false;
		this.anticipatedstay = value;
	}
	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]);
			}
		}
		if(this.patient == null)
			listOfErrors.add("Patient is mandatory");
		if(this.electiveadmissiontype == null)
			listOfErrors.add("ElectiveAdmissionType is mandatory");
		if(this.comments != null)
			if(this.comments.length() > 255)
				listOfErrors.add("The length of the field [comments] in the value object [ims.RefMan.vo.PatientElectiveListForPendingAdmissionVo] is too big. It should be less or equal to 255");
		if(this.referral == null)
			listOfErrors.add("Referral is mandatory");
		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;
	
		PatientElectiveListForPendingAdmissionVo clone = new PatientElectiveListForPendingAdmissionVo(this.id, this.version);
		
		if(this.electivelist == null)
			clone.electivelist = null;
		else
			clone.electivelist = (ims.RefMan.vo.ElectiveListConfigurationLiteVo)this.electivelist.clone();
		if(this.patient == null)
			clone.patient = null;
		else
			clone.patient = (ims.core.vo.PatientShortListVo)this.patient.clone();
		if(this.electiveadmissiontype == null)
			clone.electiveadmissiontype = null;
		else
			clone.electiveadmissiontype = (ims.RefMan.vo.lookups.ElectiveAdmissionType)this.electiveadmissiontype.clone();
		if(this.tcidetails == null)
			clone.tcidetails = null;
		else
			clone.tcidetails = (ims.RefMan.vo.PatientElectiveTCIBedManagerCommentVo)this.tcidetails.clone();
		if(this.primaryprocedure == null)
			clone.primaryprocedure = null;
		else
			clone.primaryprocedure = (ims.core.vo.ProcedureLiteVo)this.primaryprocedure.clone();
		clone.patienthasactivealerts = this.patienthasactivealerts;
		if(this.wardstatus == null)
			clone.wardstatus = null;
		else
			clone.wardstatus = (ims.core.vo.lookups.WardBayStatus)this.wardstatus.clone();
		clone.comments = this.comments;
		clone.referral = this.referral;
		if(this.preassessmentoutcome == null)
			clone.preassessmentoutcome = null;
		else
			clone.preassessmentoutcome = (ims.RefMan.vo.PreAssessmentOutcomeCommentsForPatElListVo)this.preassessmentoutcome.clone();
		if(this.responsiblehcp == null)
			clone.responsiblehcp = null;
		else
			clone.responsiblehcp = (ims.core.vo.HcpLiteVo)this.responsiblehcp.clone();
		clone.noofpreoperativenights = this.noofpreoperativenights;
		clone.anticipatedstay = this.anticipatedstay;
		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 (!(PatientElectiveListForPendingAdmissionVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PatientElectiveListForPendingAdmissionVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PatientElectiveListForPendingAdmissionVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PatientElectiveListForPendingAdmissionVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.electivelist != null)
			count++;
		if(this.patient != null)
			count++;
		if(this.electiveadmissiontype != null)
			count++;
		if(this.tcidetails != null)
			count++;
		if(this.primaryprocedure != null)
			count++;
		if(this.patienthasactivealerts != null)
			count++;
		if(this.wardstatus != null)
			count++;
		if(this.comments != null)
			count++;
		if(this.referral != null)
			count++;
		if(this.preassessmentoutcome != null)
			count++;
		if(this.responsiblehcp != null)
			count++;
		if(this.noofpreoperativenights != null)
			count++;
		if(this.anticipatedstay != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 13;
	}
	protected ims.RefMan.vo.ElectiveListConfigurationLiteVo electivelist;
	protected ims.core.vo.PatientShortListVo patient;
	protected ims.RefMan.vo.lookups.ElectiveAdmissionType electiveadmissiontype;
	protected ims.RefMan.vo.PatientElectiveTCIBedManagerCommentVo tcidetails;
	protected ims.core.vo.ProcedureLiteVo primaryprocedure;
	protected Boolean patienthasactivealerts;
	protected ims.core.vo.lookups.WardBayStatus wardstatus;
	protected String comments;
	protected ims.RefMan.vo.CatsReferralRefVo referral;
	protected ims.RefMan.vo.PreAssessmentOutcomeCommentsForPatElListVo preassessmentoutcome;
	protected ims.core.vo.HcpLiteVo responsiblehcp;
	protected Integer noofpreoperativenights;
	protected Integer anticipatedstay;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
