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

/**
 * Linked to emergency.Configuration.TriagePriorityKPConfig business object (ID: 1087100008).
 */
public class TriagePriorityKpConfigVo extends ims.emergency.configuration.vo.TriagePriorityKPConfigRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public TriagePriorityKpConfigVo()
	{
	}
	public TriagePriorityKpConfigVo(Integer id, int version)
	{
		super(id, version);
	}
	public TriagePriorityKpConfigVo(ims.emergency.vo.beans.TriagePriorityKpConfigVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.triagepriority = bean.getTriagePriority() == null ? null : ims.emergency.vo.lookups.TriagePriority.buildLookup(bean.getTriagePriority());
		this.prioritybreachwarningkpi = bean.getPriorityBreachWarningKPI();
		this.prioritybreachedkpi = bean.getPriorityBreachedKPI();
		this.prioritybreachwarningkpitextcolour = bean.getPriorityBreachWarningKPITextColour() == null ? null : bean.getPriorityBreachWarningKPITextColour().buildColor();
		this.prioritybreachwarningkpiflashingtext = bean.getPriorityBreachWarningKPIFlashingText() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getPriorityBreachWarningKPIFlashingText());
		this.prioritybreachwarningkpiflashingtextcolour = bean.getPriorityBreachWarningKPIFlashingTextColour() == null ? null : bean.getPriorityBreachWarningKPIFlashingTextColour().buildColor();
		this.prioritybreachwarningkpibackgroundcolour = bean.getPriorityBreachWarningKPIBackgroundColour() == null ? null : bean.getPriorityBreachWarningKPIBackgroundColour().buildColor();
		this.prioritybreachedkpiflashingtext = bean.getPriorityBreachedKPIFlashingText() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getPriorityBreachedKPIFlashingText());
		this.prioritybreachedkpiflashingtextcolour = bean.getPriorityBreachedKPIFlashingTextColour() == null ? null : bean.getPriorityBreachedKPIFlashingTextColour().buildColor();
		this.prioritybreachedkpibackgroundcolour = bean.getPriorityBreachedKPIBackgroundColour() == null ? null : bean.getPriorityBreachedKPIBackgroundColour().buildColor();
		this.prioritybreachkpitextcolour = bean.getPriorityBreachKPITextColour() == null ? null : bean.getPriorityBreachKPITextColour().buildColor();
		this.defaultrowcolour = bean.getDefaultRowColour() == null ? null : bean.getDefaultRowColour().buildColor();
		this.defaultfontcolour = bean.getDefaultFontColour() == null ? null : bean.getDefaultFontColour().buildColor();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.emergency.vo.beans.TriagePriorityKpConfigVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.triagepriority = bean.getTriagePriority() == null ? null : ims.emergency.vo.lookups.TriagePriority.buildLookup(bean.getTriagePriority());
		this.prioritybreachwarningkpi = bean.getPriorityBreachWarningKPI();
		this.prioritybreachedkpi = bean.getPriorityBreachedKPI();
		this.prioritybreachwarningkpitextcolour = bean.getPriorityBreachWarningKPITextColour() == null ? null : bean.getPriorityBreachWarningKPITextColour().buildColor();
		this.prioritybreachwarningkpiflashingtext = bean.getPriorityBreachWarningKPIFlashingText() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getPriorityBreachWarningKPIFlashingText());
		this.prioritybreachwarningkpiflashingtextcolour = bean.getPriorityBreachWarningKPIFlashingTextColour() == null ? null : bean.getPriorityBreachWarningKPIFlashingTextColour().buildColor();
		this.prioritybreachwarningkpibackgroundcolour = bean.getPriorityBreachWarningKPIBackgroundColour() == null ? null : bean.getPriorityBreachWarningKPIBackgroundColour().buildColor();
		this.prioritybreachedkpiflashingtext = bean.getPriorityBreachedKPIFlashingText() == null ? null : ims.core.vo.lookups.YesNo.buildLookup(bean.getPriorityBreachedKPIFlashingText());
		this.prioritybreachedkpiflashingtextcolour = bean.getPriorityBreachedKPIFlashingTextColour() == null ? null : bean.getPriorityBreachedKPIFlashingTextColour().buildColor();
		this.prioritybreachedkpibackgroundcolour = bean.getPriorityBreachedKPIBackgroundColour() == null ? null : bean.getPriorityBreachedKPIBackgroundColour().buildColor();
		this.prioritybreachkpitextcolour = bean.getPriorityBreachKPITextColour() == null ? null : bean.getPriorityBreachKPITextColour().buildColor();
		this.defaultrowcolour = bean.getDefaultRowColour() == null ? null : bean.getDefaultRowColour().buildColor();
		this.defaultfontcolour = bean.getDefaultFontColour() == null ? null : bean.getDefaultFontColour().buildColor();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.emergency.vo.beans.TriagePriorityKpConfigVoBean bean = null;
		if(map != null)
			bean = (ims.emergency.vo.beans.TriagePriorityKpConfigVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.emergency.vo.beans.TriagePriorityKpConfigVoBean();
			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("TRIAGEPRIORITY"))
			return getTriagePriority();
		if(fieldName.equals("PRIORITYBREACHWARNINGKPI"))
			return getPriorityBreachWarningKPI();
		if(fieldName.equals("PRIORITYBREACHEDKPI"))
			return getPriorityBreachedKPI();
		if(fieldName.equals("PRIORITYBREACHWARNINGKPITEXTCOLOUR"))
			return getPriorityBreachWarningKPITextColour();
		if(fieldName.equals("PRIORITYBREACHWARNINGKPIFLASHINGTEXT"))
			return getPriorityBreachWarningKPIFlashingText();
		if(fieldName.equals("PRIORITYBREACHWARNINGKPIFLASHINGTEXTCOLOUR"))
			return getPriorityBreachWarningKPIFlashingTextColour();
		if(fieldName.equals("PRIORITYBREACHWARNINGKPIBACKGROUNDCOLOUR"))
			return getPriorityBreachWarningKPIBackgroundColour();
		if(fieldName.equals("PRIORITYBREACHEDKPIFLASHINGTEXT"))
			return getPriorityBreachedKPIFlashingText();
		if(fieldName.equals("PRIORITYBREACHEDKPIFLASHINGTEXTCOLOUR"))
			return getPriorityBreachedKPIFlashingTextColour();
		if(fieldName.equals("PRIORITYBREACHEDKPIBACKGROUNDCOLOUR"))
			return getPriorityBreachedKPIBackgroundColour();
		if(fieldName.equals("PRIORITYBREACHKPITEXTCOLOUR"))
			return getPriorityBreachKPITextColour();
		if(fieldName.equals("DEFAULTROWCOLOUR"))
			return getDefaultRowColour();
		if(fieldName.equals("DEFAULTFONTCOLOUR"))
			return getDefaultFontColour();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getTriagePriorityIsNotNull()
	{
		return this.triagepriority != null;
	}
	public ims.emergency.vo.lookups.TriagePriority getTriagePriority()
	{
		return this.triagepriority;
	}
	public void setTriagePriority(ims.emergency.vo.lookups.TriagePriority value)
	{
		this.isValidated = false;
		this.triagepriority = value;
	}
	public boolean getPriorityBreachWarningKPIIsNotNull()
	{
		return this.prioritybreachwarningkpi != null;
	}
	public Integer getPriorityBreachWarningKPI()
	{
		return this.prioritybreachwarningkpi;
	}
	public void setPriorityBreachWarningKPI(Integer value)
	{
		this.isValidated = false;
		this.prioritybreachwarningkpi = value;
	}
	public boolean getPriorityBreachedKPIIsNotNull()
	{
		return this.prioritybreachedkpi != null;
	}
	public Integer getPriorityBreachedKPI()
	{
		return this.prioritybreachedkpi;
	}
	public void setPriorityBreachedKPI(Integer value)
	{
		this.isValidated = false;
		this.prioritybreachedkpi = value;
	}
	public boolean getPriorityBreachWarningKPITextColourIsNotNull()
	{
		return this.prioritybreachwarningkpitextcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachWarningKPITextColour()
	{
		return this.prioritybreachwarningkpitextcolour;
	}
	public void setPriorityBreachWarningKPITextColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachwarningkpitextcolour = value;
	}
	public boolean getPriorityBreachWarningKPIFlashingTextIsNotNull()
	{
		return this.prioritybreachwarningkpiflashingtext != null;
	}
	public ims.core.vo.lookups.YesNo getPriorityBreachWarningKPIFlashingText()
	{
		return this.prioritybreachwarningkpiflashingtext;
	}
	public void setPriorityBreachWarningKPIFlashingText(ims.core.vo.lookups.YesNo value)
	{
		this.isValidated = false;
		this.prioritybreachwarningkpiflashingtext = value;
	}
	public boolean getPriorityBreachWarningKPIFlashingTextColourIsNotNull()
	{
		return this.prioritybreachwarningkpiflashingtextcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachWarningKPIFlashingTextColour()
	{
		return this.prioritybreachwarningkpiflashingtextcolour;
	}
	public void setPriorityBreachWarningKPIFlashingTextColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachwarningkpiflashingtextcolour = value;
	}
	public boolean getPriorityBreachWarningKPIBackgroundColourIsNotNull()
	{
		return this.prioritybreachwarningkpibackgroundcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachWarningKPIBackgroundColour()
	{
		return this.prioritybreachwarningkpibackgroundcolour;
	}
	public void setPriorityBreachWarningKPIBackgroundColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachwarningkpibackgroundcolour = value;
	}
	public boolean getPriorityBreachedKPIFlashingTextIsNotNull()
	{
		return this.prioritybreachedkpiflashingtext != null;
	}
	public ims.core.vo.lookups.YesNo getPriorityBreachedKPIFlashingText()
	{
		return this.prioritybreachedkpiflashingtext;
	}
	public void setPriorityBreachedKPIFlashingText(ims.core.vo.lookups.YesNo value)
	{
		this.isValidated = false;
		this.prioritybreachedkpiflashingtext = value;
	}
	public boolean getPriorityBreachedKPIFlashingTextColourIsNotNull()
	{
		return this.prioritybreachedkpiflashingtextcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachedKPIFlashingTextColour()
	{
		return this.prioritybreachedkpiflashingtextcolour;
	}
	public void setPriorityBreachedKPIFlashingTextColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachedkpiflashingtextcolour = value;
	}
	public boolean getPriorityBreachedKPIBackgroundColourIsNotNull()
	{
		return this.prioritybreachedkpibackgroundcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachedKPIBackgroundColour()
	{
		return this.prioritybreachedkpibackgroundcolour;
	}
	public void setPriorityBreachedKPIBackgroundColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachedkpibackgroundcolour = value;
	}
	public boolean getPriorityBreachKPITextColourIsNotNull()
	{
		return this.prioritybreachkpitextcolour != null;
	}
	public ims.framework.utils.Color getPriorityBreachKPITextColour()
	{
		return this.prioritybreachkpitextcolour;
	}
	public void setPriorityBreachKPITextColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.prioritybreachkpitextcolour = value;
	}
	public boolean getDefaultRowColourIsNotNull()
	{
		return this.defaultrowcolour != null;
	}
	public ims.framework.utils.Color getDefaultRowColour()
	{
		return this.defaultrowcolour;
	}
	public void setDefaultRowColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.defaultrowcolour = value;
	}
	public boolean getDefaultFontColourIsNotNull()
	{
		return this.defaultfontcolour != null;
	}
	public ims.framework.utils.Color getDefaultFontColour()
	{
		return this.defaultfontcolour;
	}
	public void setDefaultFontColour(ims.framework.utils.Color value)
	{
		this.isValidated = false;
		this.defaultfontcolour = value;
	}
	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]);
			}
		}
		if(this.triagepriority == null)
			listOfErrors.add("TriagePriority is mandatory");
		if(this.prioritybreachedkpi == null)
			listOfErrors.add("PriorityBreachedKPI is mandatory");
		if(this.prioritybreachkpitextcolour == null)
			listOfErrors.add("PriorityBreachKPITextColour is mandatory");
		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;
	
		TriagePriorityKpConfigVo clone = new TriagePriorityKpConfigVo(this.id, this.version);
		
		if(this.triagepriority == null)
			clone.triagepriority = null;
		else
			clone.triagepriority = (ims.emergency.vo.lookups.TriagePriority)this.triagepriority.clone();
		clone.prioritybreachwarningkpi = this.prioritybreachwarningkpi;
		clone.prioritybreachedkpi = this.prioritybreachedkpi;
		if(this.prioritybreachwarningkpitextcolour == null)
			clone.prioritybreachwarningkpitextcolour = null;
		else
			clone.prioritybreachwarningkpitextcolour = (ims.framework.utils.Color)this.prioritybreachwarningkpitextcolour.clone();
		if(this.prioritybreachwarningkpiflashingtext == null)
			clone.prioritybreachwarningkpiflashingtext = null;
		else
			clone.prioritybreachwarningkpiflashingtext = (ims.core.vo.lookups.YesNo)this.prioritybreachwarningkpiflashingtext.clone();
		if(this.prioritybreachwarningkpiflashingtextcolour == null)
			clone.prioritybreachwarningkpiflashingtextcolour = null;
		else
			clone.prioritybreachwarningkpiflashingtextcolour = (ims.framework.utils.Color)this.prioritybreachwarningkpiflashingtextcolour.clone();
		if(this.prioritybreachwarningkpibackgroundcolour == null)
			clone.prioritybreachwarningkpibackgroundcolour = null;
		else
			clone.prioritybreachwarningkpibackgroundcolour = (ims.framework.utils.Color)this.prioritybreachwarningkpibackgroundcolour.clone();
		if(this.prioritybreachedkpiflashingtext == null)
			clone.prioritybreachedkpiflashingtext = null;
		else
			clone.prioritybreachedkpiflashingtext = (ims.core.vo.lookups.YesNo)this.prioritybreachedkpiflashingtext.clone();
		if(this.prioritybreachedkpiflashingtextcolour == null)
			clone.prioritybreachedkpiflashingtextcolour = null;
		else
			clone.prioritybreachedkpiflashingtextcolour = (ims.framework.utils.Color)this.prioritybreachedkpiflashingtextcolour.clone();
		if(this.prioritybreachedkpibackgroundcolour == null)
			clone.prioritybreachedkpibackgroundcolour = null;
		else
			clone.prioritybreachedkpibackgroundcolour = (ims.framework.utils.Color)this.prioritybreachedkpibackgroundcolour.clone();
		if(this.prioritybreachkpitextcolour == null)
			clone.prioritybreachkpitextcolour = null;
		else
			clone.prioritybreachkpitextcolour = (ims.framework.utils.Color)this.prioritybreachkpitextcolour.clone();
		if(this.defaultrowcolour == null)
			clone.defaultrowcolour = null;
		else
			clone.defaultrowcolour = (ims.framework.utils.Color)this.defaultrowcolour.clone();
		if(this.defaultfontcolour == null)
			clone.defaultfontcolour = null;
		else
			clone.defaultfontcolour = (ims.framework.utils.Color)this.defaultfontcolour.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 (!(TriagePriorityKpConfigVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A TriagePriorityKpConfigVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((TriagePriorityKpConfigVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((TriagePriorityKpConfigVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.triagepriority != null)
			count++;
		if(this.prioritybreachwarningkpi != null)
			count++;
		if(this.prioritybreachedkpi != null)
			count++;
		if(this.prioritybreachwarningkpitextcolour != null)
			count++;
		if(this.prioritybreachwarningkpiflashingtext != null)
			count++;
		if(this.prioritybreachwarningkpiflashingtextcolour != null)
			count++;
		if(this.prioritybreachwarningkpibackgroundcolour != null)
			count++;
		if(this.prioritybreachedkpiflashingtext != null)
			count++;
		if(this.prioritybreachedkpiflashingtextcolour != null)
			count++;
		if(this.prioritybreachedkpibackgroundcolour != null)
			count++;
		if(this.prioritybreachkpitextcolour != null)
			count++;
		if(this.defaultrowcolour != null)
			count++;
		if(this.defaultfontcolour != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 13;
	}
	protected ims.emergency.vo.lookups.TriagePriority triagepriority;
	protected Integer prioritybreachwarningkpi;
	protected Integer prioritybreachedkpi;
	protected ims.framework.utils.Color prioritybreachwarningkpitextcolour;
	protected ims.core.vo.lookups.YesNo prioritybreachwarningkpiflashingtext;
	protected ims.framework.utils.Color prioritybreachwarningkpiflashingtextcolour;
	protected ims.framework.utils.Color prioritybreachwarningkpibackgroundcolour;
	protected ims.core.vo.lookups.YesNo prioritybreachedkpiflashingtext;
	protected ims.framework.utils.Color prioritybreachedkpiflashingtextcolour;
	protected ims.framework.utils.Color prioritybreachedkpibackgroundcolour;
	protected ims.framework.utils.Color prioritybreachkpitextcolour;
	protected ims.framework.utils.Color defaultrowcolour;
	protected ims.framework.utils.Color defaultfontcolour;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
