/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/RACPC/src/ims/racpc/forms/racpcexerciseecg/BaseLogic.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.racpc.forms.racpcexerciseecg;

public abstract class BaseLogic extends Handlers
{
	public final Class getDomainInterface() throws ClassNotFoundException
	{
		return ims.racpc.domain.RACPCExerciseECG.class;
	}
	public final void setContext(ims.framework.UIEngine engine, GenForm form, ims.racpc.domain.RACPCExerciseECG domain)
	{
		setContext(engine, form);
		this.domain = domain;
	}
	protected final void oncmbCMDValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbCMD().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPPreAssessmentCHD existingInstance = (ims.clinical.vo.lookups.RACPPreAssessmentCHD)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbCMDLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.clinical.vo.lookups.RACPPreAssessmentCHD)
		{
			ims.clinical.vo.lookups.RACPPreAssessmentCHD instance = (ims.clinical.vo.lookups.RACPPreAssessmentCHD)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbCMDLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPPreAssessmentCHD existingInstance = (ims.clinical.vo.lookups.RACPPreAssessmentCHD)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbCMD().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbCMDLookup()
	{
		this.form.cmbCMD().clear();
		ims.clinical.vo.lookups.RACPPreAssessmentCHDCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getRACPPreAssessmentCHD(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbCMD().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbCMDLookupValue(int id)
	{
		ims.clinical.vo.lookups.RACPPreAssessmentCHD instance = ims.clinical.vo.lookups.LookupHelper.getRACPPreAssessmentCHDInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbCMD().setValue(instance);
	}
	protected final void defaultcmbCMDLookupValue()
	{
		this.form.cmbCMD().setValue((ims.clinical.vo.lookups.RACPPreAssessmentCHD)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.RACPPreAssessmentCHD.class, engine.getFormName().getID(), ims.clinical.vo.lookups.RACPPreAssessmentCHD.TYPE_ID));
	}
	protected final void oncmbPainValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbPain().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.racpc.vo.lookups.PainExperienced existingInstance = (ims.racpc.vo.lookups.PainExperienced)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbPainLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.racpc.vo.lookups.PainExperienced)
		{
			ims.racpc.vo.lookups.PainExperienced instance = (ims.racpc.vo.lookups.PainExperienced)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbPainLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.racpc.vo.lookups.PainExperienced existingInstance = (ims.racpc.vo.lookups.PainExperienced)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbPain().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbPainLookup()
	{
		this.form.cmbPain().clear();
		ims.racpc.vo.lookups.PainExperiencedCollection lookupCollection = ims.racpc.vo.lookups.LookupHelper.getPainExperienced(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbPain().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbPainLookupValue(int id)
	{
		ims.racpc.vo.lookups.PainExperienced instance = ims.racpc.vo.lookups.LookupHelper.getPainExperiencedInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbPain().setValue(instance);
	}
	protected final void defaultcmbPainLookupValue()
	{
		this.form.cmbPain().setValue((ims.racpc.vo.lookups.PainExperienced)domain.getLookupService().getDefaultInstance(ims.racpc.vo.lookups.PainExperienced.class, engine.getFormName().getID(), ims.racpc.vo.lookups.PainExperienced.TYPE_ID));
	}
	protected final void oncmbDysponeaValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbDysponea().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.nursing.vo.lookups.BreathingDyspnoea existingInstance = (ims.nursing.vo.lookups.BreathingDyspnoea)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbDysponeaLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.nursing.vo.lookups.BreathingDyspnoea)
		{
			ims.nursing.vo.lookups.BreathingDyspnoea instance = (ims.nursing.vo.lookups.BreathingDyspnoea)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbDysponeaLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.nursing.vo.lookups.BreathingDyspnoea existingInstance = (ims.nursing.vo.lookups.BreathingDyspnoea)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbDysponea().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbDysponeaLookup()
	{
		this.form.cmbDysponea().clear();
		ims.nursing.vo.lookups.BreathingDyspnoeaCollection lookupCollection = ims.nursing.vo.lookups.LookupHelper.getBreathingDyspnoea(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbDysponea().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbDysponeaLookupValue(int id)
	{
		ims.nursing.vo.lookups.BreathingDyspnoea instance = ims.nursing.vo.lookups.LookupHelper.getBreathingDyspnoeaInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbDysponea().setValue(instance);
	}
	protected final void defaultcmbDysponeaLookupValue()
	{
		this.form.cmbDysponea().setValue((ims.nursing.vo.lookups.BreathingDyspnoea)domain.getLookupService().getDefaultInstance(ims.nursing.vo.lookups.BreathingDyspnoea.class, engine.getFormName().getID(), ims.nursing.vo.lookups.BreathingDyspnoea.TYPE_ID));
	}
	protected final void oncmbResultValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbResult().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPExerciseECGResult existingInstance = (ims.clinical.vo.lookups.RACPExerciseECGResult)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbResultLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.clinical.vo.lookups.RACPExerciseECGResult)
		{
			ims.clinical.vo.lookups.RACPExerciseECGResult instance = (ims.clinical.vo.lookups.RACPExerciseECGResult)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbResultLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPExerciseECGResult existingInstance = (ims.clinical.vo.lookups.RACPExerciseECGResult)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbResult().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbResultLookup()
	{
		this.form.cmbResult().clear();
		ims.clinical.vo.lookups.RACPExerciseECGResultCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getRACPExerciseECGResult(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbResult().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbResultLookupValue(int id)
	{
		ims.clinical.vo.lookups.RACPExerciseECGResult instance = ims.clinical.vo.lookups.LookupHelper.getRACPExerciseECGResultInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbResult().setValue(instance);
	}
	protected final void defaultcmbResultLookupValue()
	{
		this.form.cmbResult().setValue((ims.clinical.vo.lookups.RACPExerciseECGResult)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.RACPExerciseECGResult.class, engine.getFormName().getID(), ims.clinical.vo.lookups.RACPExerciseECGResult.TYPE_ID));
	}
	protected final void oncmbInterpretationValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbInterpretation().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPExerciseECGInterpretation existingInstance = (ims.clinical.vo.lookups.RACPExerciseECGInterpretation)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbInterpretationLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.clinical.vo.lookups.RACPExerciseECGInterpretation)
		{
			ims.clinical.vo.lookups.RACPExerciseECGInterpretation instance = (ims.clinical.vo.lookups.RACPExerciseECGInterpretation)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbInterpretationLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPExerciseECGInterpretation existingInstance = (ims.clinical.vo.lookups.RACPExerciseECGInterpretation)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbInterpretation().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbInterpretationLookup()
	{
		this.form.cmbInterpretation().clear();
		ims.clinical.vo.lookups.RACPExerciseECGInterpretationCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getRACPExerciseECGInterpretation(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbInterpretation().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbInterpretationLookupValue(int id)
	{
		ims.clinical.vo.lookups.RACPExerciseECGInterpretation instance = ims.clinical.vo.lookups.LookupHelper.getRACPExerciseECGInterpretationInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbInterpretation().setValue(instance);
	}
	protected final void defaultcmbInterpretationLookupValue()
	{
		this.form.cmbInterpretation().setValue((ims.clinical.vo.lookups.RACPExerciseECGInterpretation)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.RACPExerciseECGInterpretation.class, engine.getFormName().getID(), ims.clinical.vo.lookups.RACPExerciseECGInterpretation.TYPE_ID));
	}
	protected final void oncmbProtocolValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.cmbProtocol().getValues();

		if(value == null)
		{
			if(listOfValues != null && listOfValues.size() > 0)
			{
				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPProtocol existingInstance = (ims.clinical.vo.lookups.RACPProtocol)listOfValues.get(x);
					if(!existingInstance.isActive())
					{
						bindcmbProtocolLookup();
						return;
					}
				}
			}
		}
		else if(value instanceof ims.clinical.vo.lookups.RACPProtocol)
		{
			ims.clinical.vo.lookups.RACPProtocol instance = (ims.clinical.vo.lookups.RACPProtocol)value;

			if(listOfValues != null)
			{
				if(listOfValues.size() == 0)
					bindcmbProtocolLookup();

				for(int x = 0; x < listOfValues.size(); x++)
				{
					ims.clinical.vo.lookups.RACPProtocol existingInstance = (ims.clinical.vo.lookups.RACPProtocol)listOfValues.get(x);
					if(existingInstance.equals(instance))
						return;
				}
			}

			this.form.cmbProtocol().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbProtocolLookup()
	{
		this.form.cmbProtocol().clear();
		ims.clinical.vo.lookups.RACPProtocolCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getRACPProtocol(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.cmbProtocol().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbProtocolLookupValue(int id)
	{
		ims.clinical.vo.lookups.RACPProtocol instance = ims.clinical.vo.lookups.LookupHelper.getRACPProtocolInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.cmbProtocol().setValue(instance);
	}
	protected final void defaultcmbProtocolLookupValue()
	{
		this.form.cmbProtocol().setValue((ims.clinical.vo.lookups.RACPProtocol)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.RACPProtocol.class, engine.getFormName().getID(), ims.clinical.vo.lookups.RACPProtocol.TYPE_ID));
	}
	public final void free()
	{
		super.free();
		domain = null;
	}
	
	protected ims.racpc.domain.RACPCExerciseECG domain;
}
