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

/**
 * Linked to core.clinical.Dementia business object (ID: 1003100117).
 */
public class DementiaVo extends ims.core.clinical.vo.DementiaRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public DementiaVo()
	{
	}
	public DementiaVo(Integer id, int version)
	{
		super(id, version);
	}
	public DementiaVo(ims.clinical.vo.beans.DementiaVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo();
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.breachdatetime = bean.getBreachDateTime() == null ? null : bean.getBreachDateTime().buildDateTime();
		this.ageonadmission = bean.getAgeOnAdmission();
		this.dischargedatetime = bean.getDischargeDateTime() == null ? null : bean.getDischargeDateTime().buildDateTime();
		this.currentworkliststatus = bean.getCurrentWorklistStatus() == null ? null : bean.getCurrentWorklistStatus().buildVo();
		this.historicalworkliststatus = ims.clinical.vo.DementiaWorklistStatusVoCollection.buildFromBeanCollection(bean.getHistoricalWorklistStatus());
		this.dementiaconfirmed = bean.getDementiaConfirmed();
		this.deliriumconfirmed = bean.getDeliriumConfirmed();
		this.amtsscore = bean.getAMTSScore();
		this.steponefind = bean.getStepOneFind() == null ? null : bean.getStepOneFind().buildVo();
		this.steptwoassess = bean.getStepTwoAssess() == null ? null : bean.getStepTwoAssess().buildVo();
		this.confirmedpatientputondementiapathway = bean.getConfirmedPatientPutOnDementiaPathway();
		this.admissiondetail = bean.getAdmissionDetail() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetail().getId()), bean.getAdmissionDetail().getVersion());
		this.isexcludedfromworklist = bean.getIsExcludedFromWorklist();
		this.followupassessments = ims.clinical.vo.DementiaAssessAndInvestigateVoCollection.buildFromBeanCollection(bean.getFollowUpAssessments());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.DementiaVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo(map);
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.breachdatetime = bean.getBreachDateTime() == null ? null : bean.getBreachDateTime().buildDateTime();
		this.ageonadmission = bean.getAgeOnAdmission();
		this.dischargedatetime = bean.getDischargeDateTime() == null ? null : bean.getDischargeDateTime().buildDateTime();
		this.currentworkliststatus = bean.getCurrentWorklistStatus() == null ? null : bean.getCurrentWorklistStatus().buildVo(map);
		this.historicalworkliststatus = ims.clinical.vo.DementiaWorklistStatusVoCollection.buildFromBeanCollection(bean.getHistoricalWorklistStatus());
		this.dementiaconfirmed = bean.getDementiaConfirmed();
		this.deliriumconfirmed = bean.getDeliriumConfirmed();
		this.amtsscore = bean.getAMTSScore();
		this.steponefind = bean.getStepOneFind() == null ? null : bean.getStepOneFind().buildVo(map);
		this.steptwoassess = bean.getStepTwoAssess() == null ? null : bean.getStepTwoAssess().buildVo(map);
		this.confirmedpatientputondementiapathway = bean.getConfirmedPatientPutOnDementiaPathway();
		this.admissiondetail = bean.getAdmissionDetail() == null ? null : new ims.core.admin.pas.vo.AdmissionDetailRefVo(new Integer(bean.getAdmissionDetail().getId()), bean.getAdmissionDetail().getVersion());
		this.isexcludedfromworklist = bean.getIsExcludedFromWorklist();
		this.followupassessments = ims.clinical.vo.DementiaAssessAndInvestigateVoCollection.buildFromBeanCollection(bean.getFollowUpAssessments());
	}
	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.DementiaVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.DementiaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.DementiaVoBean();
			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("PATIENT"))
			return getPatient();
		if(fieldName.equals("ADMISSIONDATETIME"))
			return getAdmissionDateTime();
		if(fieldName.equals("BREACHDATETIME"))
			return getBreachDateTime();
		if(fieldName.equals("AGEONADMISSION"))
			return getAgeOnAdmission();
		if(fieldName.equals("DISCHARGEDATETIME"))
			return getDischargeDateTime();
		if(fieldName.equals("CURRENTWORKLISTSTATUS"))
			return getCurrentWorklistStatus();
		if(fieldName.equals("HISTORICALWORKLISTSTATUS"))
			return getHistoricalWorklistStatus();
		if(fieldName.equals("DEMENTIACONFIRMED"))
			return getDementiaConfirmed();
		if(fieldName.equals("DELIRIUMCONFIRMED"))
			return getDeliriumConfirmed();
		if(fieldName.equals("AMTSSCORE"))
			return getAMTSScore();
		if(fieldName.equals("STEPONEFIND"))
			return getStepOneFind();
		if(fieldName.equals("STEPTWOASSESS"))
			return getStepTwoAssess();
		if(fieldName.equals("CONFIRMEDPATIENTPUTONDEMENTIAPATHWAY"))
			return getConfirmedPatientPutOnDementiaPathway();
		if(fieldName.equals("ADMISSIONDETAIL"))
			return getAdmissionDetail();
		if(fieldName.equals("ISEXCLUDEDFROMWORKLIST"))
			return getIsExcludedFromWorklist();
		if(fieldName.equals("FOLLOWUPASSESSMENTS"))
			return getFollowUpAssessments();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.vo.PatientForDementiaLiteVo getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.vo.PatientForDementiaLiteVo value)
	{
		this.isValidated = false;
		this.patient = value;
	}
	public boolean getAdmissionDateTimeIsNotNull()
	{
		return this.admissiondatetime != null;
	}
	public ims.framework.utils.DateTime getAdmissionDateTime()
	{
		return this.admissiondatetime;
	}
	public void setAdmissionDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.admissiondatetime = value;
	}
	public boolean getBreachDateTimeIsNotNull()
	{
		return this.breachdatetime != null;
	}
	public ims.framework.utils.DateTime getBreachDateTime()
	{
		return this.breachdatetime;
	}
	public void setBreachDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.breachdatetime = value;
	}
	public boolean getAgeOnAdmissionIsNotNull()
	{
		return this.ageonadmission != null;
	}
	public Integer getAgeOnAdmission()
	{
		return this.ageonadmission;
	}
	public void setAgeOnAdmission(Integer value)
	{
		this.isValidated = false;
		this.ageonadmission = value;
	}
	public boolean getDischargeDateTimeIsNotNull()
	{
		return this.dischargedatetime != null;
	}
	public ims.framework.utils.DateTime getDischargeDateTime()
	{
		return this.dischargedatetime;
	}
	public void setDischargeDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.dischargedatetime = value;
	}
	public boolean getCurrentWorklistStatusIsNotNull()
	{
		return this.currentworkliststatus != null;
	}
	public ims.clinical.vo.DementiaWorklistStatusVo getCurrentWorklistStatus()
	{
		return this.currentworkliststatus;
	}
	public void setCurrentWorklistStatus(ims.clinical.vo.DementiaWorklistStatusVo value)
	{
		this.isValidated = false;
		this.currentworkliststatus = value;
	}
	public boolean getHistoricalWorklistStatusIsNotNull()
	{
		return this.historicalworkliststatus != null;
	}
	public ims.clinical.vo.DementiaWorklistStatusVoCollection getHistoricalWorklistStatus()
	{
		return this.historicalworkliststatus;
	}
	public void setHistoricalWorklistStatus(ims.clinical.vo.DementiaWorklistStatusVoCollection value)
	{
		this.isValidated = false;
		this.historicalworkliststatus = value;
	}
	public boolean getDementiaConfirmedIsNotNull()
	{
		return this.dementiaconfirmed != null;
	}
	public Boolean getDementiaConfirmed()
	{
		return this.dementiaconfirmed;
	}
	public void setDementiaConfirmed(Boolean value)
	{
		this.isValidated = false;
		this.dementiaconfirmed = value;
	}
	public boolean getDeliriumConfirmedIsNotNull()
	{
		return this.deliriumconfirmed != null;
	}
	public Boolean getDeliriumConfirmed()
	{
		return this.deliriumconfirmed;
	}
	public void setDeliriumConfirmed(Boolean value)
	{
		this.isValidated = false;
		this.deliriumconfirmed = value;
	}
	public boolean getAMTSScoreIsNotNull()
	{
		return this.amtsscore != null;
	}
	public Integer getAMTSScore()
	{
		return this.amtsscore;
	}
	public void setAMTSScore(Integer value)
	{
		this.isValidated = false;
		this.amtsscore = value;
	}
	public boolean getStepOneFindIsNotNull()
	{
		return this.steponefind != null;
	}
	public ims.clinical.vo.DementiaFindVo getStepOneFind()
	{
		return this.steponefind;
	}
	public void setStepOneFind(ims.clinical.vo.DementiaFindVo value)
	{
		this.isValidated = false;
		this.steponefind = value;
	}
	public boolean getStepTwoAssessIsNotNull()
	{
		return this.steptwoassess != null;
	}
	public ims.clinical.vo.DementiaAssessAndInvestigateVo getStepTwoAssess()
	{
		return this.steptwoassess;
	}
	public void setStepTwoAssess(ims.clinical.vo.DementiaAssessAndInvestigateVo value)
	{
		this.isValidated = false;
		this.steptwoassess = value;
	}
	public boolean getConfirmedPatientPutOnDementiaPathwayIsNotNull()
	{
		return this.confirmedpatientputondementiapathway != null;
	}
	public Boolean getConfirmedPatientPutOnDementiaPathway()
	{
		return this.confirmedpatientputondementiapathway;
	}
	public void setConfirmedPatientPutOnDementiaPathway(Boolean value)
	{
		this.isValidated = false;
		this.confirmedpatientputondementiapathway = value;
	}
	public boolean getAdmissionDetailIsNotNull()
	{
		return this.admissiondetail != null;
	}
	public ims.core.admin.pas.vo.AdmissionDetailRefVo getAdmissionDetail()
	{
		return this.admissiondetail;
	}
	public void setAdmissionDetail(ims.core.admin.pas.vo.AdmissionDetailRefVo value)
	{
		this.isValidated = false;
		this.admissiondetail = value;
	}
	public boolean getIsExcludedFromWorklistIsNotNull()
	{
		return this.isexcludedfromworklist != null;
	}
	public Boolean getIsExcludedFromWorklist()
	{
		return this.isexcludedfromworklist;
	}
	public void setIsExcludedFromWorklist(Boolean value)
	{
		this.isValidated = false;
		this.isexcludedfromworklist = value;
	}
	public boolean getFollowUpAssessmentsIsNotNull()
	{
		return this.followupassessments != null;
	}
	public ims.clinical.vo.DementiaAssessAndInvestigateVoCollection getFollowUpAssessments()
	{
		return this.followupassessments;
	}
	public void setFollowUpAssessments(ims.clinical.vo.DementiaAssessAndInvestigateVoCollection value)
	{
		this.isValidated = false;
		this.followupassessments = 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.currentworkliststatus != null)
		{
			if(!this.currentworkliststatus.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.historicalworkliststatus != null)
		{
			if(!this.historicalworkliststatus.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.steponefind != null)
		{
			if(!this.steponefind.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.steptwoassess != null)
		{
			if(!this.steptwoassess.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.followupassessments != null)
		{
			if(!this.followupassessments.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.patient != null)
		{
			String[] listOfOtherErrors = this.patient.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.admissiondatetime == null)
			listOfErrors.add("AdmissionDateTime is mandatory");
		if(this.ageonadmission == null)
			listOfErrors.add("AgeOnAdmission is mandatory");
		if(this.currentworkliststatus != null)
		{
			String[] listOfOtherErrors = this.currentworkliststatus.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.historicalworkliststatus != null)
		{
			String[] listOfOtherErrors = this.historicalworkliststatus.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.steponefind != null)
		{
			String[] listOfOtherErrors = this.steponefind.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.steptwoassess != null)
		{
			String[] listOfOtherErrors = this.steptwoassess.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.followupassessments != null)
		{
			String[] listOfOtherErrors = this.followupassessments.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;
	
		DementiaVo clone = new DementiaVo(this.id, this.version);
		
		if(this.patient == null)
			clone.patient = null;
		else
			clone.patient = (ims.core.vo.PatientForDementiaLiteVo)this.patient.clone();
		if(this.admissiondatetime == null)
			clone.admissiondatetime = null;
		else
			clone.admissiondatetime = (ims.framework.utils.DateTime)this.admissiondatetime.clone();
		if(this.breachdatetime == null)
			clone.breachdatetime = null;
		else
			clone.breachdatetime = (ims.framework.utils.DateTime)this.breachdatetime.clone();
		clone.ageonadmission = this.ageonadmission;
		if(this.dischargedatetime == null)
			clone.dischargedatetime = null;
		else
			clone.dischargedatetime = (ims.framework.utils.DateTime)this.dischargedatetime.clone();
		if(this.currentworkliststatus == null)
			clone.currentworkliststatus = null;
		else
			clone.currentworkliststatus = (ims.clinical.vo.DementiaWorklistStatusVo)this.currentworkliststatus.clone();
		if(this.historicalworkliststatus == null)
			clone.historicalworkliststatus = null;
		else
			clone.historicalworkliststatus = (ims.clinical.vo.DementiaWorklistStatusVoCollection)this.historicalworkliststatus.clone();
		clone.dementiaconfirmed = this.dementiaconfirmed;
		clone.deliriumconfirmed = this.deliriumconfirmed;
		clone.amtsscore = this.amtsscore;
		if(this.steponefind == null)
			clone.steponefind = null;
		else
			clone.steponefind = (ims.clinical.vo.DementiaFindVo)this.steponefind.clone();
		if(this.steptwoassess == null)
			clone.steptwoassess = null;
		else
			clone.steptwoassess = (ims.clinical.vo.DementiaAssessAndInvestigateVo)this.steptwoassess.clone();
		clone.confirmedpatientputondementiapathway = this.confirmedpatientputondementiapathway;
		clone.admissiondetail = this.admissiondetail;
		clone.isexcludedfromworklist = this.isexcludedfromworklist;
		if(this.followupassessments == null)
			clone.followupassessments = null;
		else
			clone.followupassessments = (ims.clinical.vo.DementiaAssessAndInvestigateVoCollection)this.followupassessments.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 (!(DementiaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A DementiaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((DementiaVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((DementiaVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.patient != null)
			count++;
		if(this.admissiondatetime != null)
			count++;
		if(this.breachdatetime != null)
			count++;
		if(this.ageonadmission != null)
			count++;
		if(this.dischargedatetime != null)
			count++;
		if(this.currentworkliststatus != null)
			count++;
		if(this.historicalworkliststatus != null)
			count++;
		if(this.dementiaconfirmed != null)
			count++;
		if(this.deliriumconfirmed != null)
			count++;
		if(this.amtsscore != null)
			count++;
		if(this.steponefind != null)
			count++;
		if(this.steptwoassess != null)
			count++;
		if(this.confirmedpatientputondementiapathway != null)
			count++;
		if(this.admissiondetail != null)
			count++;
		if(this.isexcludedfromworklist != null)
			count++;
		if(this.followupassessments != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 16;
	}
	protected ims.core.vo.PatientForDementiaLiteVo patient;
	protected ims.framework.utils.DateTime admissiondatetime;
	protected ims.framework.utils.DateTime breachdatetime;
	protected Integer ageonadmission;
	protected ims.framework.utils.DateTime dischargedatetime;
	protected ims.clinical.vo.DementiaWorklistStatusVo currentworkliststatus;
	protected ims.clinical.vo.DementiaWorklistStatusVoCollection historicalworkliststatus;
	protected Boolean dementiaconfirmed;
	protected Boolean deliriumconfirmed;
	protected Integer amtsscore;
	protected ims.clinical.vo.DementiaFindVo steponefind;
	protected ims.clinical.vo.DementiaAssessAndInvestigateVo steptwoassess;
	protected Boolean confirmedpatientputondementiapathway;
	protected ims.core.admin.pas.vo.AdmissionDetailRefVo admissiondetail;
	protected Boolean isexcludedfromworklist;
	protected ims.clinical.vo.DementiaAssessAndInvestigateVoCollection followupassessments;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
