/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/clinical/vo/InpatientEpisodeForVTERiskAsessmentVo.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.admin.pas.Inpatient Episode business object (ID: 1014100000).
 */
public class InpatientEpisodeForVTERiskAsessmentVo extends ims.core.admin.pas.vo.InpatientEpisodeRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public InpatientEpisodeForVTERiskAsessmentVo()
	{
	}
	public InpatientEpisodeForVTERiskAsessmentVo(Integer id, int version)
	{
		super(id, version);
	}
	public InpatientEpisodeForVTERiskAsessmentVo(ims.clinical.vo.beans.InpatientEpisodeForVTERiskAsessmentVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : new ims.core.admin.pas.vo.PASEventRefVo(new Integer(bean.getPasEvent().getId()), bean.getPasEvent().getVersion());
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.vteassessmentstatus = bean.getVTEAssessmentStatus() == null ? null : ims.clinical.vo.lookups.VTEAsessmentStatus.buildLookup(bean.getVTEAssessmentStatus());
		this.vteriskassessment = bean.getVTERiskAssessment() == null ? null : new ims.core.clinical.vo.VTERiskAssessmentRefVo(new Integer(bean.getVTERiskAssessment().getId()), bean.getVTERiskAssessment().getVersion());
		this.vteassessmentstatusreason = bean.getVTEAssessmentStatusReason() == null ? null : ims.clinical.vo.lookups.VTEAssessmentStatusReason.buildLookup(bean.getVTEAssessmentStatusReason());
		this.estdischargedate = bean.getEstDischargeDate() == null ? null : bean.getEstDischargeDate().buildDateTime();
		this.confirmeddischargedatetime = bean.getConfirmedDischargeDateTime() == null ? null : bean.getConfirmedDischargeDateTime().buildDateTime();
		this.isonhomeleave = bean.getIsOnHomeLeave();
		this.dateonhomeleave = bean.getDateOnHomeLeave() == null ? null : bean.getDateOnHomeLeave().buildDate();
		this.timeonhomeleave = bean.getTimeOnHomeLeave() == null ? null : bean.getTimeOnHomeLeave().buildTime();
		this.expecteddateofreturn = bean.getExpectedDateOfReturn() == null ? null : bean.getExpectedDateOfReturn().buildDate();
		this.expectedtimeofreturn = bean.getExpectedTimeOfReturn() == null ? null : bean.getExpectedTimeOfReturn().buildTime();
		this.latestsecsscore = bean.getLatestSECSScore() == null ? null : bean.getLatestSECSScore().buildVo();
		this.isconfirmeddischarge = bean.getIsConfirmedDischarge();
		this.currenttrackingmovement = bean.getCurrentTrackingMovement() == null ? null : bean.getCurrentTrackingMovement().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.InpatientEpisodeForVTERiskAsessmentVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.pasevent = bean.getPasEvent() == null ? null : new ims.core.admin.pas.vo.PASEventRefVo(new Integer(bean.getPasEvent().getId()), bean.getPasEvent().getVersion());
		this.admissiondatetime = bean.getAdmissionDateTime() == null ? null : bean.getAdmissionDateTime().buildDateTime();
		this.vteassessmentstatus = bean.getVTEAssessmentStatus() == null ? null : ims.clinical.vo.lookups.VTEAsessmentStatus.buildLookup(bean.getVTEAssessmentStatus());
		this.vteriskassessment = bean.getVTERiskAssessment() == null ? null : new ims.core.clinical.vo.VTERiskAssessmentRefVo(new Integer(bean.getVTERiskAssessment().getId()), bean.getVTERiskAssessment().getVersion());
		this.vteassessmentstatusreason = bean.getVTEAssessmentStatusReason() == null ? null : ims.clinical.vo.lookups.VTEAssessmentStatusReason.buildLookup(bean.getVTEAssessmentStatusReason());
		this.estdischargedate = bean.getEstDischargeDate() == null ? null : bean.getEstDischargeDate().buildDateTime();
		this.confirmeddischargedatetime = bean.getConfirmedDischargeDateTime() == null ? null : bean.getConfirmedDischargeDateTime().buildDateTime();
		this.isonhomeleave = bean.getIsOnHomeLeave();
		this.dateonhomeleave = bean.getDateOnHomeLeave() == null ? null : bean.getDateOnHomeLeave().buildDate();
		this.timeonhomeleave = bean.getTimeOnHomeLeave() == null ? null : bean.getTimeOnHomeLeave().buildTime();
		this.expecteddateofreturn = bean.getExpectedDateOfReturn() == null ? null : bean.getExpectedDateOfReturn().buildDate();
		this.expectedtimeofreturn = bean.getExpectedTimeOfReturn() == null ? null : bean.getExpectedTimeOfReturn().buildTime();
		this.latestsecsscore = bean.getLatestSECSScore() == null ? null : bean.getLatestSECSScore().buildVo(map);
		this.isconfirmeddischarge = bean.getIsConfirmedDischarge();
		this.currenttrackingmovement = bean.getCurrentTrackingMovement() == null ? null : bean.getCurrentTrackingMovement().buildVo(map);
	}
	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.InpatientEpisodeForVTERiskAsessmentVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.InpatientEpisodeForVTERiskAsessmentVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.InpatientEpisodeForVTERiskAsessmentVoBean();
			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("PASEVENT"))
			return getPasEvent();
		if(fieldName.equals("ADMISSIONDATETIME"))
			return getAdmissionDateTime();
		if(fieldName.equals("VTEASSESSMENTSTATUS"))
			return getVTEAssessmentStatus();
		if(fieldName.equals("VTERISKASSESSMENT"))
			return getVTERiskAssessment();
		if(fieldName.equals("VTEASSESSMENTSTATUSREASON"))
			return getVTEAssessmentStatusReason();
		if(fieldName.equals("ESTDISCHARGEDATE"))
			return getEstDischargeDate();
		if(fieldName.equals("CONFIRMEDDISCHARGEDATETIME"))
			return getConfirmedDischargeDateTime();
		if(fieldName.equals("ISONHOMELEAVE"))
			return getIsOnHomeLeave();
		if(fieldName.equals("DATEONHOMELEAVE"))
			return getDateOnHomeLeave();
		if(fieldName.equals("TIMEONHOMELEAVE"))
			return getTimeOnHomeLeave();
		if(fieldName.equals("EXPECTEDDATEOFRETURN"))
			return getExpectedDateOfReturn();
		if(fieldName.equals("EXPECTEDTIMEOFRETURN"))
			return getExpectedTimeOfReturn();
		if(fieldName.equals("LATESTSECSSCORE"))
			return getLatestSECSScore();
		if(fieldName.equals("ISCONFIRMEDDISCHARGE"))
			return getIsConfirmedDischarge();
		if(fieldName.equals("CURRENTTRACKINGMOVEMENT"))
			return getCurrentTrackingMovement();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPasEventIsNotNull()
	{
		return this.pasevent != null;
	}
	public ims.core.admin.pas.vo.PASEventRefVo getPasEvent()
	{
		return this.pasevent;
	}
	public void setPasEvent(ims.core.admin.pas.vo.PASEventRefVo value)
	{
		this.isValidated = false;
		this.pasevent = 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 getVTEAssessmentStatusIsNotNull()
	{
		return this.vteassessmentstatus != null;
	}
	public ims.clinical.vo.lookups.VTEAsessmentStatus getVTEAssessmentStatus()
	{
		return this.vteassessmentstatus;
	}
	public void setVTEAssessmentStatus(ims.clinical.vo.lookups.VTEAsessmentStatus value)
	{
		this.isValidated = false;
		this.vteassessmentstatus = value;
	}
	public boolean getVTERiskAssessmentIsNotNull()
	{
		return this.vteriskassessment != null;
	}
	public ims.core.clinical.vo.VTERiskAssessmentRefVo getVTERiskAssessment()
	{
		return this.vteriskassessment;
	}
	public void setVTERiskAssessment(ims.core.clinical.vo.VTERiskAssessmentRefVo value)
	{
		this.isValidated = false;
		this.vteriskassessment = value;
	}
	public boolean getVTEAssessmentStatusReasonIsNotNull()
	{
		return this.vteassessmentstatusreason != null;
	}
	public ims.clinical.vo.lookups.VTEAssessmentStatusReason getVTEAssessmentStatusReason()
	{
		return this.vteassessmentstatusreason;
	}
	public void setVTEAssessmentStatusReason(ims.clinical.vo.lookups.VTEAssessmentStatusReason value)
	{
		this.isValidated = false;
		this.vteassessmentstatusreason = value;
	}
	public boolean getEstDischargeDateIsNotNull()
	{
		return this.estdischargedate != null;
	}
	public ims.framework.utils.DateTime getEstDischargeDate()
	{
		return this.estdischargedate;
	}
	public void setEstDischargeDate(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.estdischargedate = value;
	}
	public boolean getConfirmedDischargeDateTimeIsNotNull()
	{
		return this.confirmeddischargedatetime != null;
	}
	public ims.framework.utils.DateTime getConfirmedDischargeDateTime()
	{
		return this.confirmeddischargedatetime;
	}
	public void setConfirmedDischargeDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.confirmeddischargedatetime = value;
	}
	public boolean getIsOnHomeLeaveIsNotNull()
	{
		return this.isonhomeleave != null;
	}
	public Boolean getIsOnHomeLeave()
	{
		return this.isonhomeleave;
	}
	public void setIsOnHomeLeave(Boolean value)
	{
		this.isValidated = false;
		this.isonhomeleave = value;
	}
	public boolean getDateOnHomeLeaveIsNotNull()
	{
		return this.dateonhomeleave != null;
	}
	public ims.framework.utils.Date getDateOnHomeLeave()
	{
		return this.dateonhomeleave;
	}
	public void setDateOnHomeLeave(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.dateonhomeleave = value;
	}
	public boolean getTimeOnHomeLeaveIsNotNull()
	{
		return this.timeonhomeleave != null;
	}
	public ims.framework.utils.Time getTimeOnHomeLeave()
	{
		return this.timeonhomeleave;
	}
	public void setTimeOnHomeLeave(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.timeonhomeleave = value;
	}
	public boolean getExpectedDateOfReturnIsNotNull()
	{
		return this.expecteddateofreturn != null;
	}
	public ims.framework.utils.Date getExpectedDateOfReturn()
	{
		return this.expecteddateofreturn;
	}
	public void setExpectedDateOfReturn(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.expecteddateofreturn = value;
	}
	public boolean getExpectedTimeOfReturnIsNotNull()
	{
		return this.expectedtimeofreturn != null;
	}
	public ims.framework.utils.Time getExpectedTimeOfReturn()
	{
		return this.expectedtimeofreturn;
	}
	public void setExpectedTimeOfReturn(ims.framework.utils.Time value)
	{
		this.isValidated = false;
		this.expectedtimeofreturn = value;
	}
	public boolean getLatestSECSScoreIsNotNull()
	{
		return this.latestsecsscore != null;
	}
	public ims.clinical.vo.PatientSECSLiteVo getLatestSECSScore()
	{
		return this.latestsecsscore;
	}
	public void setLatestSECSScore(ims.clinical.vo.PatientSECSLiteVo value)
	{
		this.isValidated = false;
		this.latestsecsscore = value;
	}
	public boolean getIsConfirmedDischargeIsNotNull()
	{
		return this.isconfirmeddischarge != null;
	}
	public Boolean getIsConfirmedDischarge()
	{
		return this.isconfirmeddischarge;
	}
	public void setIsConfirmedDischarge(Boolean value)
	{
		this.isValidated = false;
		this.isconfirmeddischarge = value;
	}
	public boolean getCurrentTrackingMovementIsNotNull()
	{
		return this.currenttrackingmovement != null;
	}
	public ims.core.vo.TrackingMovementVo getCurrentTrackingMovement()
	{
		return this.currenttrackingmovement;
	}
	public void setCurrentTrackingMovement(ims.core.vo.TrackingMovementVo value)
	{
		this.isValidated = false;
		this.currenttrackingmovement = value;
	}
	/**
	* isDischargeDueWithin24Hrs()
	*/
	public boolean isDischargeDueWithin24Hrs()
	{
		if (this.confirmeddischargedatetime == null && this.estdischargedate == null)
			return false;
				
		ims.framework.utils.DateTime nowPlus24Hrs = new ims.framework.utils.DateTime();
		nowPlus24Hrs.addHours(24);
				
		if ((this.confirmeddischargedatetime != null && this.confirmeddischargedatetime.isLessOrEqualThan(nowPlus24Hrs)) ||(this.estdischargedate != null && this.estdischargedate.isLessOrEqualThan(nowPlus24Hrs)))
			return true;
				
		return false;
	}
	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 void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		InpatientEpisodeForVTERiskAsessmentVo clone = new InpatientEpisodeForVTERiskAsessmentVo(this.id, this.version);
		
		clone.pasevent = this.pasevent;
		if(this.admissiondatetime == null)
			clone.admissiondatetime = null;
		else
			clone.admissiondatetime = (ims.framework.utils.DateTime)this.admissiondatetime.clone();
		if(this.vteassessmentstatus == null)
			clone.vteassessmentstatus = null;
		else
			clone.vteassessmentstatus = (ims.clinical.vo.lookups.VTEAsessmentStatus)this.vteassessmentstatus.clone();
		clone.vteriskassessment = this.vteriskassessment;
		if(this.vteassessmentstatusreason == null)
			clone.vteassessmentstatusreason = null;
		else
			clone.vteassessmentstatusreason = (ims.clinical.vo.lookups.VTEAssessmentStatusReason)this.vteassessmentstatusreason.clone();
		if(this.estdischargedate == null)
			clone.estdischargedate = null;
		else
			clone.estdischargedate = (ims.framework.utils.DateTime)this.estdischargedate.clone();
		if(this.confirmeddischargedatetime == null)
			clone.confirmeddischargedatetime = null;
		else
			clone.confirmeddischargedatetime = (ims.framework.utils.DateTime)this.confirmeddischargedatetime.clone();
		clone.isonhomeleave = this.isonhomeleave;
		if(this.dateonhomeleave == null)
			clone.dateonhomeleave = null;
		else
			clone.dateonhomeleave = (ims.framework.utils.Date)this.dateonhomeleave.clone();
		if(this.timeonhomeleave == null)
			clone.timeonhomeleave = null;
		else
			clone.timeonhomeleave = (ims.framework.utils.Time)this.timeonhomeleave.clone();
		if(this.expecteddateofreturn == null)
			clone.expecteddateofreturn = null;
		else
			clone.expecteddateofreturn = (ims.framework.utils.Date)this.expecteddateofreturn.clone();
		if(this.expectedtimeofreturn == null)
			clone.expectedtimeofreturn = null;
		else
			clone.expectedtimeofreturn = (ims.framework.utils.Time)this.expectedtimeofreturn.clone();
		if(this.latestsecsscore == null)
			clone.latestsecsscore = null;
		else
			clone.latestsecsscore = (ims.clinical.vo.PatientSECSLiteVo)this.latestsecsscore.clone();
		clone.isconfirmeddischarge = this.isconfirmeddischarge;
		if(this.currenttrackingmovement == null)
			clone.currenttrackingmovement = null;
		else
			clone.currenttrackingmovement = (ims.core.vo.TrackingMovementVo)this.currenttrackingmovement.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 (!(InpatientEpisodeForVTERiskAsessmentVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A InpatientEpisodeForVTERiskAsessmentVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((InpatientEpisodeForVTERiskAsessmentVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((InpatientEpisodeForVTERiskAsessmentVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.pasevent != null)
			count++;
		if(this.admissiondatetime != null)
			count++;
		if(this.vteassessmentstatus != null)
			count++;
		if(this.vteriskassessment != null)
			count++;
		if(this.vteassessmentstatusreason != null)
			count++;
		if(this.estdischargedate != null)
			count++;
		if(this.confirmeddischargedatetime != null)
			count++;
		if(this.isonhomeleave != null)
			count++;
		if(this.dateonhomeleave != null)
			count++;
		if(this.timeonhomeleave != null)
			count++;
		if(this.expecteddateofreturn != null)
			count++;
		if(this.expectedtimeofreturn != null)
			count++;
		if(this.latestsecsscore != null)
			count++;
		if(this.isconfirmeddischarge != null)
			count++;
		if(this.currenttrackingmovement != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 15;
	}
	protected ims.core.admin.pas.vo.PASEventRefVo pasevent;
	protected ims.framework.utils.DateTime admissiondatetime;
	protected ims.clinical.vo.lookups.VTEAsessmentStatus vteassessmentstatus;
	protected ims.core.clinical.vo.VTERiskAssessmentRefVo vteriskassessment;
	protected ims.clinical.vo.lookups.VTEAssessmentStatusReason vteassessmentstatusreason;
	protected ims.framework.utils.DateTime estdischargedate;
	protected ims.framework.utils.DateTime confirmeddischargedatetime;
	protected Boolean isonhomeleave;
	protected ims.framework.utils.Date dateonhomeleave;
	protected ims.framework.utils.Time timeonhomeleave;
	protected ims.framework.utils.Date expecteddateofreturn;
	protected ims.framework.utils.Time expectedtimeofreturn;
	protected ims.clinical.vo.PatientSECSLiteVo latestsecsscore;
	protected Boolean isconfirmeddischarge;
	protected ims.core.vo.TrackingMovementVo currenttrackingmovement;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
