/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/clinical/vo/RACPExerciseECGVo.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 clinical.RACPExerciseECG business object (ID: 1072100078).
 */
public class RACPExerciseECGVo extends ims.clinical.vo.RACPExerciseECGRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public RACPExerciseECGVo()
	{
	}
	public RACPExerciseECGVo(Integer id, int version)
	{
		super(id, version);
	}
	public RACPExerciseECGVo(ims.clinical.vo.beans.RACPExerciseECGVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.preassesseschd = bean.getPreAssessesCHD() == null ? null : ims.clinical.vo.lookups.RACPPreAssessmentCHD.buildLookup(bean.getPreAssessesCHD());
		this.protocol = bean.getProtocol() == null ? null : ims.clinical.vo.lookups.RACPProtocol.buildLookup(bean.getProtocol());
		this.medicationattest = ims.clinical.vo.lookups.RACPMedicationAtTestCollection.buildFromBeanCollection(bean.getMedicationAtTest());
		this.durationmins = bean.getDurationMins();
		this.durationsecs = bean.getDurationSecs();
		this.vspulse = bean.getVSPulse() == null ? null : bean.getVSPulse().buildVo();
		this.vsbp = bean.getVSBP() == null ? null : bean.getVSBP().buildVo();
		this.maxpredheartrate = bean.getMaxPredHeartRate();
		this.stopreasons = ims.clinical.vo.lookups.RACPStopTestReasonCollection.buildFromBeanCollection(bean.getStopReasons());
		this.dysponea = bean.getDysponea() == null ? null : ims.nursing.vo.lookups.BreathingDyspnoea.buildLookup(bean.getDysponea());
		this.sympomonset = bean.getSympomOnset();
		this.otherfindings = ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection.buildFromBeanCollection(bean.getOtherFindings());
		this.maxstchangemm = bean.getMaxSTChangeMM();
		this.minsto1mmchange = bean.getMinsTo1mmChange();
		this.secsto1mmchange = bean.getSecsTo1mmChange();
		this.result = bean.getResult() == null ? null : ims.clinical.vo.lookups.RACPExerciseECGResult.buildLookup(bean.getResult());
		this.interpretation = bean.getInterpretation() == null ? null : ims.clinical.vo.lookups.RACPExerciseECGInterpretation.buildLookup(bean.getInterpretation());
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.painexperienced = bean.getPainExperienced() == null ? null : ims.racpc.vo.lookups.PainExperienced.buildLookup(bean.getPainExperienced());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.RACPExerciseECGVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.preassesseschd = bean.getPreAssessesCHD() == null ? null : ims.clinical.vo.lookups.RACPPreAssessmentCHD.buildLookup(bean.getPreAssessesCHD());
		this.protocol = bean.getProtocol() == null ? null : ims.clinical.vo.lookups.RACPProtocol.buildLookup(bean.getProtocol());
		this.medicationattest = ims.clinical.vo.lookups.RACPMedicationAtTestCollection.buildFromBeanCollection(bean.getMedicationAtTest());
		this.durationmins = bean.getDurationMins();
		this.durationsecs = bean.getDurationSecs();
		this.vspulse = bean.getVSPulse() == null ? null : bean.getVSPulse().buildVo(map);
		this.vsbp = bean.getVSBP() == null ? null : bean.getVSBP().buildVo(map);
		this.maxpredheartrate = bean.getMaxPredHeartRate();
		this.stopreasons = ims.clinical.vo.lookups.RACPStopTestReasonCollection.buildFromBeanCollection(bean.getStopReasons());
		this.dysponea = bean.getDysponea() == null ? null : ims.nursing.vo.lookups.BreathingDyspnoea.buildLookup(bean.getDysponea());
		this.sympomonset = bean.getSympomOnset();
		this.otherfindings = ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection.buildFromBeanCollection(bean.getOtherFindings());
		this.maxstchangemm = bean.getMaxSTChangeMM();
		this.minsto1mmchange = bean.getMinsTo1mmChange();
		this.secsto1mmchange = bean.getSecsTo1mmChange();
		this.result = bean.getResult() == null ? null : ims.clinical.vo.lookups.RACPExerciseECGResult.buildLookup(bean.getResult());
		this.interpretation = bean.getInterpretation() == null ? null : ims.clinical.vo.lookups.RACPExerciseECGInterpretation.buildLookup(bean.getInterpretation());
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.painexperienced = bean.getPainExperienced() == null ? null : ims.racpc.vo.lookups.PainExperienced.buildLookup(bean.getPainExperienced());
	}
	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.RACPExerciseECGVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.RACPExerciseECGVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.RACPExerciseECGVoBean();
			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("PREASSESSESCHD"))
			return getPreAssessesCHD();
		if(fieldName.equals("PROTOCOL"))
			return getProtocol();
		if(fieldName.equals("MEDICATIONATTEST"))
			return getMedicationAtTest();
		if(fieldName.equals("DURATIONMINS"))
			return getDurationMins();
		if(fieldName.equals("DURATIONSECS"))
			return getDurationSecs();
		if(fieldName.equals("VSPULSE"))
			return getVSPulse();
		if(fieldName.equals("VSBP"))
			return getVSBP();
		if(fieldName.equals("MAXPREDHEARTRATE"))
			return getMaxPredHeartRate();
		if(fieldName.equals("STOPREASONS"))
			return getStopReasons();
		if(fieldName.equals("DYSPONEA"))
			return getDysponea();
		if(fieldName.equals("SYMPOMONSET"))
			return getSympomOnset();
		if(fieldName.equals("OTHERFINDINGS"))
			return getOtherFindings();
		if(fieldName.equals("MAXSTCHANGEMM"))
			return getMaxSTChangeMM();
		if(fieldName.equals("MINSTO1MMCHANGE"))
			return getMinsTo1mmChange();
		if(fieldName.equals("SECSTO1MMCHANGE"))
			return getSecsTo1mmChange();
		if(fieldName.equals("RESULT"))
			return getResult();
		if(fieldName.equals("INTERPRETATION"))
			return getInterpretation();
		if(fieldName.equals("CARECONTEXT"))
			return getCareContext();
		if(fieldName.equals("PAINEXPERIENCED"))
			return getPainExperienced();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPreAssessesCHDIsNotNull()
	{
		return this.preassesseschd != null;
	}
	public ims.clinical.vo.lookups.RACPPreAssessmentCHD getPreAssessesCHD()
	{
		return this.preassesseschd;
	}
	public void setPreAssessesCHD(ims.clinical.vo.lookups.RACPPreAssessmentCHD value)
	{
		this.isValidated = false;
		this.preassesseschd = value;
	}
	public boolean getProtocolIsNotNull()
	{
		return this.protocol != null;
	}
	public ims.clinical.vo.lookups.RACPProtocol getProtocol()
	{
		return this.protocol;
	}
	public void setProtocol(ims.clinical.vo.lookups.RACPProtocol value)
	{
		this.isValidated = false;
		this.protocol = value;
	}
	public boolean getMedicationAtTestIsNotNull()
	{
		return this.medicationattest != null;
	}
	public ims.clinical.vo.lookups.RACPMedicationAtTestCollection getMedicationAtTest()
	{
		return this.medicationattest;
	}
	public void setMedicationAtTest(ims.clinical.vo.lookups.RACPMedicationAtTestCollection value)
	{
		this.isValidated = false;
		this.medicationattest = value;
	}
	public boolean getDurationMinsIsNotNull()
	{
		return this.durationmins != null;
	}
	public Integer getDurationMins()
	{
		return this.durationmins;
	}
	public void setDurationMins(Integer value)
	{
		this.isValidated = false;
		this.durationmins = value;
	}
	public boolean getDurationSecsIsNotNull()
	{
		return this.durationsecs != null;
	}
	public Integer getDurationSecs()
	{
		return this.durationsecs;
	}
	public void setDurationSecs(Integer value)
	{
		this.isValidated = false;
		this.durationsecs = value;
	}
	public boolean getVSPulseIsNotNull()
	{
		return this.vspulse != null;
	}
	public ims.core.vo.VSPulse getVSPulse()
	{
		return this.vspulse;
	}
	public void setVSPulse(ims.core.vo.VSPulse value)
	{
		this.isValidated = false;
		this.vspulse = value;
	}
	public boolean getVSBPIsNotNull()
	{
		return this.vsbp != null;
	}
	public ims.core.vo.VSBloodPressure getVSBP()
	{
		return this.vsbp;
	}
	public void setVSBP(ims.core.vo.VSBloodPressure value)
	{
		this.isValidated = false;
		this.vsbp = value;
	}
	public boolean getMaxPredHeartRateIsNotNull()
	{
		return this.maxpredheartrate != null;
	}
	public Integer getMaxPredHeartRate()
	{
		return this.maxpredheartrate;
	}
	public void setMaxPredHeartRate(Integer value)
	{
		this.isValidated = false;
		this.maxpredheartrate = value;
	}
	public boolean getStopReasonsIsNotNull()
	{
		return this.stopreasons != null;
	}
	public ims.clinical.vo.lookups.RACPStopTestReasonCollection getStopReasons()
	{
		return this.stopreasons;
	}
	public void setStopReasons(ims.clinical.vo.lookups.RACPStopTestReasonCollection value)
	{
		this.isValidated = false;
		this.stopreasons = value;
	}
	public boolean getDysponeaIsNotNull()
	{
		return this.dysponea != null;
	}
	public ims.nursing.vo.lookups.BreathingDyspnoea getDysponea()
	{
		return this.dysponea;
	}
	public void setDysponea(ims.nursing.vo.lookups.BreathingDyspnoea value)
	{
		this.isValidated = false;
		this.dysponea = value;
	}
	public boolean getSympomOnsetIsNotNull()
	{
		return this.sympomonset != null;
	}
	public Integer getSympomOnset()
	{
		return this.sympomonset;
	}
	public void setSympomOnset(Integer value)
	{
		this.isValidated = false;
		this.sympomonset = value;
	}
	public boolean getOtherFindingsIsNotNull()
	{
		return this.otherfindings != null;
	}
	public ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection getOtherFindings()
	{
		return this.otherfindings;
	}
	public void setOtherFindings(ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection value)
	{
		this.isValidated = false;
		this.otherfindings = value;
	}
	public boolean getMaxSTChangeMMIsNotNull()
	{
		return this.maxstchangemm != null;
	}
	public Integer getMaxSTChangeMM()
	{
		return this.maxstchangemm;
	}
	public void setMaxSTChangeMM(Integer value)
	{
		this.isValidated = false;
		this.maxstchangemm = value;
	}
	public boolean getMinsTo1mmChangeIsNotNull()
	{
		return this.minsto1mmchange != null;
	}
	public Integer getMinsTo1mmChange()
	{
		return this.minsto1mmchange;
	}
	public void setMinsTo1mmChange(Integer value)
	{
		this.isValidated = false;
		this.minsto1mmchange = value;
	}
	public boolean getSecsTo1mmChangeIsNotNull()
	{
		return this.secsto1mmchange != null;
	}
	public Integer getSecsTo1mmChange()
	{
		return this.secsto1mmchange;
	}
	public void setSecsTo1mmChange(Integer value)
	{
		this.isValidated = false;
		this.secsto1mmchange = value;
	}
	public boolean getResultIsNotNull()
	{
		return this.result != null;
	}
	public ims.clinical.vo.lookups.RACPExerciseECGResult getResult()
	{
		return this.result;
	}
	public void setResult(ims.clinical.vo.lookups.RACPExerciseECGResult value)
	{
		this.isValidated = false;
		this.result = value;
	}
	public boolean getInterpretationIsNotNull()
	{
		return this.interpretation != null;
	}
	public ims.clinical.vo.lookups.RACPExerciseECGInterpretation getInterpretation()
	{
		return this.interpretation;
	}
	public void setInterpretation(ims.clinical.vo.lookups.RACPExerciseECGInterpretation value)
	{
		this.isValidated = false;
		this.interpretation = value;
	}
	public boolean getCareContextIsNotNull()
	{
		return this.carecontext != null;
	}
	public ims.core.admin.vo.CareContextRefVo getCareContext()
	{
		return this.carecontext;
	}
	public void setCareContext(ims.core.admin.vo.CareContextRefVo value)
	{
		this.isValidated = false;
		this.carecontext = value;
	}
	public boolean getPainExperiencedIsNotNull()
	{
		return this.painexperienced != null;
	}
	public ims.racpc.vo.lookups.PainExperienced getPainExperienced()
	{
		return this.painexperienced;
	}
	public void setPainExperienced(ims.racpc.vo.lookups.PainExperienced value)
	{
		this.isValidated = false;
		this.painexperienced = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.vspulse != null)
		{
			if(!this.vspulse.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.vsbp != null)
		{
			if(!this.vsbp.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.vspulse != null)
		{
			String[] listOfOtherErrors = this.vspulse.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.vsbp != null)
		{
			String[] listOfOtherErrors = this.vsbp.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.carecontext == null)
			listOfErrors.add("CareContext is mandatory");
		if(this.countFieldsWithValue() < 1)
		{
			listOfErrors.add("A minimum of 1 data fields must be entered");
		}
		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;
	
		RACPExerciseECGVo clone = new RACPExerciseECGVo(this.id, this.version);
		
		if(this.preassesseschd == null)
			clone.preassesseschd = null;
		else
			clone.preassesseschd = (ims.clinical.vo.lookups.RACPPreAssessmentCHD)this.preassesseschd.clone();
		if(this.protocol == null)
			clone.protocol = null;
		else
			clone.protocol = (ims.clinical.vo.lookups.RACPProtocol)this.protocol.clone();
		if(this.medicationattest == null)
			clone.medicationattest = null;
		else
			clone.medicationattest = (ims.clinical.vo.lookups.RACPMedicationAtTestCollection)this.medicationattest.clone();
		clone.durationmins = this.durationmins;
		clone.durationsecs = this.durationsecs;
		if(this.vspulse == null)
			clone.vspulse = null;
		else
			clone.vspulse = (ims.core.vo.VSPulse)this.vspulse.clone();
		if(this.vsbp == null)
			clone.vsbp = null;
		else
			clone.vsbp = (ims.core.vo.VSBloodPressure)this.vsbp.clone();
		clone.maxpredheartrate = this.maxpredheartrate;
		if(this.stopreasons == null)
			clone.stopreasons = null;
		else
			clone.stopreasons = (ims.clinical.vo.lookups.RACPStopTestReasonCollection)this.stopreasons.clone();
		if(this.dysponea == null)
			clone.dysponea = null;
		else
			clone.dysponea = (ims.nursing.vo.lookups.BreathingDyspnoea)this.dysponea.clone();
		clone.sympomonset = this.sympomonset;
		if(this.otherfindings == null)
			clone.otherfindings = null;
		else
			clone.otherfindings = (ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection)this.otherfindings.clone();
		clone.maxstchangemm = this.maxstchangemm;
		clone.minsto1mmchange = this.minsto1mmchange;
		clone.secsto1mmchange = this.secsto1mmchange;
		if(this.result == null)
			clone.result = null;
		else
			clone.result = (ims.clinical.vo.lookups.RACPExerciseECGResult)this.result.clone();
		if(this.interpretation == null)
			clone.interpretation = null;
		else
			clone.interpretation = (ims.clinical.vo.lookups.RACPExerciseECGInterpretation)this.interpretation.clone();
		clone.carecontext = this.carecontext;
		if(this.painexperienced == null)
			clone.painexperienced = null;
		else
			clone.painexperienced = (ims.racpc.vo.lookups.PainExperienced)this.painexperienced.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 (!(RACPExerciseECGVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A RACPExerciseECGVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((RACPExerciseECGVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((RACPExerciseECGVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.preassesseschd != null)
			count++;
		if(this.protocol != null)
			count++;
		if(this.medicationattest != null)
			count++;
		if(this.durationmins != null)
			count++;
		if(this.durationsecs != null)
			count++;
		if(this.vspulse != null)
			count++;
		if(this.vsbp != null)
			count++;
		if(this.maxpredheartrate != null)
			count++;
		if(this.stopreasons != null)
			count++;
		if(this.dysponea != null)
			count++;
		if(this.sympomonset != null)
			count++;
		if(this.otherfindings != null)
			count++;
		if(this.maxstchangemm != null)
			count++;
		if(this.minsto1mmchange != null)
			count++;
		if(this.secsto1mmchange != null)
			count++;
		if(this.result != null)
			count++;
		if(this.interpretation != null)
			count++;
		if(this.carecontext != null)
			count++;
		if(this.painexperienced != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 19;
	}
	protected ims.clinical.vo.lookups.RACPPreAssessmentCHD preassesseschd;
	protected ims.clinical.vo.lookups.RACPProtocol protocol;
	protected ims.clinical.vo.lookups.RACPMedicationAtTestCollection medicationattest;
	protected Integer durationmins;
	protected Integer durationsecs;
	protected ims.core.vo.VSPulse vspulse;
	protected ims.core.vo.VSBloodPressure vsbp;
	protected Integer maxpredheartrate;
	protected ims.clinical.vo.lookups.RACPStopTestReasonCollection stopreasons;
	protected ims.nursing.vo.lookups.BreathingDyspnoea dysponea;
	protected Integer sympomonset;
	protected ims.clinical.vo.lookups.RACPExerciseECGFindingsCollection otherfindings;
	protected Integer maxstchangemm;
	protected Integer minsto1mmchange;
	protected Integer secsto1mmchange;
	protected ims.clinical.vo.lookups.RACPExerciseECGResult result;
	protected ims.clinical.vo.lookups.RACPExerciseECGInterpretation interpretation;
	protected ims.core.admin.vo.CareContextRefVo carecontext;
	protected ims.racpc.vo.lookups.PainExperienced painexperienced;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
