/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/Nursing/src/ims/nursing/forms/invasivedevice/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.nursing.forms.invasivedevice;

public abstract class BaseLogic extends Handlers
{
	private java.util.ArrayList lookupUsageErrors;

	public final Class getDomainInterface() throws ClassNotFoundException
	{
		return ims.nursing.domain.InvasiveDevice.class;
	}
	public final void setContext(ims.framework.UIEngine engine, GenForm form, ims.nursing.domain.InvasiveDevice domain)
	{
		setContext(engine, form);
		this.domain = domain;
		if(domain.getLookupService().countLookupInstances(ims.clinical.vo.lookups.InvasiveDeviceRemovalReasonCollection.class, ims.clinical.vo.lookups.InvasiveDeviceRemovalReason.class, 1231026, true) == 0)
		{
			if(lookupUsageErrors == null)
				lookupUsageErrors = new java.util.ArrayList();
			lookupUsageErrors.add("The lookup type 'InvasiveDeviceRemovalReason' (ID: 1231026) must have at least one active instance configured.");
		}
		if(domain.getLookupService().countLookupInstances(ims.clinical.vo.lookups.InvasiveDeviceActionCollection.class, ims.clinical.vo.lookups.InvasiveDeviceAction.class, 1231037, true) == 0)
		{
			if(lookupUsageErrors == null)
				lookupUsageErrors = new java.util.ArrayList();
			lookupUsageErrors.add("The lookup type 'InvasiveDeviceAction' (ID: 1231037) must have at least one active instance configured.");
		}
		if(domain.getLookupService().countLookupInstances(ims.clinical.vo.lookups.InvasiveDeviceVIPScaleCollection.class, ims.clinical.vo.lookups.InvasiveDeviceVIPScale.class, 1231036, true) == 0)
		{
			if(lookupUsageErrors == null)
				lookupUsageErrors = new java.util.ArrayList();
			lookupUsageErrors.add("The lookup type 'InvasiveDeviceVIPScale' (ID: 1231036) must have at least one active instance configured.");
		}
	}
	public final String[] getLookupUsageErrors()
	{
		if(lookupUsageErrors == null)
			return null;
		String[] errors = new String[lookupUsageErrors.size()];
		for(int x = 0; x < lookupUsageErrors.size(); x++)
		{
			errors[x] = (String)lookupUsageErrors.get(x);
		}
		return errors;
	}
	protected final void onansCultureValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.ctnDetail().lyrDetails().tabDevice().ansCulture().getValues();

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

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

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

			this.form.ctnDetail().lyrDetails().tabDevice().ansCulture().addOption(instance);
		}
	}
	protected final void bindansCultureLookup()
	{
		this.form.ctnDetail().lyrDetails().tabDevice().ansCulture().clear();
		ims.core.vo.lookups.YesNoCollection lookupCollection = ims.core.vo.lookups.LookupHelper.getYesNo(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.ctnDetail().lyrDetails().tabDevice().ansCulture().addOption(lookupCollection.get(x));
		}
	}
	protected final void defaultansCultureLookupValue()
	{
		this.form.ctnDetail().lyrDetails().tabDevice().ansCulture().setValue((ims.core.vo.lookups.YesNo)domain.getLookupService().getDefaultInstance(ims.core.vo.lookups.YesNo.class, engine.getFormName().getID(), ims.core.vo.lookups.YesNo.TYPE_ID));
	}
	protected final void oncmbRemovalReasonValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().getValues();

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

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

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

			this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbRemovalReasonLookup()
	{
		this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().clear();
		ims.clinical.vo.lookups.InvasiveDeviceRemovalReasonCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceRemovalReason(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbRemovalReasonLookupValue(int id)
	{
		ims.clinical.vo.lookups.InvasiveDeviceRemovalReason instance = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceRemovalReasonInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().setValue(instance);
	}
	protected final void defaultcmbRemovalReasonLookupValue()
	{
		this.form.ctnDetail().lyrDetails().tabDevice().cmbRemovalReason().setValue((ims.clinical.vo.lookups.InvasiveDeviceRemovalReason)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.InvasiveDeviceRemovalReason.class, engine.getFormName().getID(), ims.clinical.vo.lookups.InvasiveDeviceRemovalReason.TYPE_ID));
	}
	protected final void oncmbVipSoreValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().getValues();

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

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

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

			this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbVipSoreLookup()
	{
		this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().clear();
		ims.clinical.vo.lookups.InvasiveDeviceVIPScaleCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceVIPScale(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbVipSoreLookupValue(int id)
	{
		ims.clinical.vo.lookups.InvasiveDeviceVIPScale instance = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceVIPScaleInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().setValue(instance);
	}
	protected final void defaultcmbVipSoreLookupValue()
	{
		this.form.ctnDetail().lyrDetails().tabVIP().cmbVipSore().setValue((ims.clinical.vo.lookups.InvasiveDeviceVIPScale)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.InvasiveDeviceVIPScale.class, engine.getFormName().getID(), ims.clinical.vo.lookups.InvasiveDeviceVIPScale.TYPE_ID));
	}
	protected final void oncmbActionValueSet(Object value)
	{
		java.util.ArrayList listOfValues = this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().getValues();

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

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

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

			this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
		}
	}
	protected final void bindcmbActionLookup()
	{
		this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().clear();
		ims.clinical.vo.lookups.InvasiveDeviceActionCollection lookupCollection = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceAction(this.domain.getLookupService());
		for(int x = 0; x < lookupCollection.size(); x++)
		{
			this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().newRow(lookupCollection.get(x), lookupCollection.get(x).getText(), lookupCollection.get(x).getImage(), lookupCollection.get(x).getTextColor());
		}
	}
	protected final void setcmbActionLookupValue(int id)
	{
		ims.clinical.vo.lookups.InvasiveDeviceAction instance = ims.clinical.vo.lookups.LookupHelper.getInvasiveDeviceActionInstance(this.domain.getLookupService(), id);
		if(instance != null)
			this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().setValue(instance);
	}
	protected final void defaultcmbActionLookupValue()
	{
		this.form.ctnDetail().lyrDetails().tabVIP().cmbAction().setValue((ims.clinical.vo.lookups.InvasiveDeviceAction)domain.getLookupService().getDefaultInstance(ims.clinical.vo.lookups.InvasiveDeviceAction.class, engine.getFormName().getID(), ims.clinical.vo.lookups.InvasiveDeviceAction.TYPE_ID));
	}
	public final void free()
	{
		super.free();
		domain = null;
	}
	
	protected ims.nursing.domain.InvasiveDevice domain;
}
