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

import ims.framework.cn.data.TreeNode;
import java.util.ArrayList;
import ims.framework.utils.Image;
import ims.framework.utils.Color;

public class CodingItemType extends ims.vo.LookupInstVo implements TreeNode
{
	private static final long serialVersionUID = 1L;

	public CodingItemType()
	{
		super();
	}
	public CodingItemType(int id)
	{
		super(id, "", true);
	}
	public CodingItemType(int id, String text, boolean active)
	{
		super(id, text, active, null, null, null);
	}
	public CodingItemType(int id, String text, boolean active, CodingItemType parent, Image image)
	{
		super(id, text, active, parent, image);
	}
	public CodingItemType(int id, String text, boolean active, CodingItemType parent, Image image, Color color)
	{
		super(id, text, active, parent, image, color);
	}
	public CodingItemType(int id, String text, boolean active, CodingItemType parent, Image image, Color color, int order)
	{
		super(id, text, active, parent, image, color, order);
	}
	public static CodingItemType buildLookup(ims.vo.LookupInstanceBean bean)
	{
		return new CodingItemType(bean.getId(), bean.getText(), bean.isActive());
	}
	public String toString()
	{
		if(getText() != null)
			return getText();
		return "";
	}
	public TreeNode getParentNode()
	{
		return (CodingItemType)super.getParentInstance();
	}
	public CodingItemType getParent()
	{
		return (CodingItemType)super.getParentInstance();
	}
	public void setParent(CodingItemType parent)
	{
		super.setParentInstance(parent);
	}
	public TreeNode[] getChildren()
	{
		ArrayList children = super.getChildInstances();
		CodingItemType[] typedChildren = new CodingItemType[children.size()];
		for (int i = 0; i < children.size(); i++)
		{
			typedChildren[i] = (CodingItemType)children.get(i);
		}
		return typedChildren;
	}
	public int addChild(TreeNode child)
	{
		if (child instanceof CodingItemType)
		{
			super.addChild((CodingItemType)child);
		}
		return super.getChildInstances().size();
	}
	public int removeChild(TreeNode child)
	{
		if (child instanceof CodingItemType)
		{
			super.removeChild((CodingItemType)child);
		}
		return super.getChildInstances().size();
	}
	public Image getExpandedImage()
	{
		return super.getImage();
	}
	public Image getCollapsedImage()
	{
		return super.getImage();
	}
	public static ims.framework.IItemCollection getNegativeInstancesAsIItemCollection()
	{
		CodingItemTypeCollection result = new CodingItemTypeCollection();
		result.add(PROBLEM);
		result.add(DIAGNOSIS);
		result.add(COMPLICATION);
		result.add(ALLERGY);
		result.add(MEDICATION);
		result.add(PROCEDURE);
		result.add(FAMILY_HISTORY);
		result.add(IMAGING_EVENT);
		return result;
	}
	public static CodingItemType[] getNegativeInstances()
	{
		CodingItemType[] instances = new CodingItemType[8];
		instances[0] = PROBLEM;
		instances[1] = DIAGNOSIS;
		instances[2] = COMPLICATION;
		instances[3] = ALLERGY;
		instances[4] = MEDICATION;
		instances[5] = PROCEDURE;
		instances[6] = FAMILY_HISTORY;
		instances[7] = IMAGING_EVENT;
		return instances;
	}
	public static String[] getNegativeInstanceNames()
	{
		String[] negativeInstances = new String[8];
		negativeInstances[0] = "PROBLEM";
		negativeInstances[1] = "DIAGNOSIS";
		negativeInstances[2] = "COMPLICATION";
		negativeInstances[3] = "ALLERGY";
		negativeInstances[4] = "MEDICATION";
		negativeInstances[5] = "PROCEDURE";
		negativeInstances[6] = "FAMILY_HISTORY";
		negativeInstances[7] = "IMAGING_EVENT";
		return negativeInstances;
	}
	public static CodingItemType getNegativeInstance(String name)
	{
		if(name == null)
			return null;
		String[] negativeInstances = getNegativeInstanceNames();
		for (int i = 0; i < negativeInstances.length; i++)
		{
			if(negativeInstances[i].equals(name))
				return getNegativeInstances()[i];
		}
		return null;
	}
	public static CodingItemType getNegativeInstance(Integer id)
	{
		if(id == null)
			return null;
		CodingItemType[] negativeInstances = getNegativeInstances();
		for (int i = 0; i < negativeInstances.length; i++)
		{
			if(negativeInstances[i].getID() == id)
				return negativeInstances[i];
		}
		return null;
	}
	public int getTypeId()
	{
		return TYPE_ID;
	}
	public static final int TYPE_ID = 1231038;
	public static final CodingItemType PROBLEM = new CodingItemType(-938, "Problem", true, null, null, Color.Default);
	public static final CodingItemType DIAGNOSIS = new CodingItemType(-940, "Diagnosis", true, null, null, Color.Default);
	public static final CodingItemType COMPLICATION = new CodingItemType(-944, "Complication", true, null, null, Color.Default);
	public static final CodingItemType ALLERGY = new CodingItemType(-946, "Allergy", true, null, null, Color.Default);
	public static final CodingItemType MEDICATION = new CodingItemType(-947, "Medication", true, null, null, Color.Default);
	public static final CodingItemType PROCEDURE = new CodingItemType(-948, "Procedure", true, null, null, Color.Default);
	public static final CodingItemType FAMILY_HISTORY = new CodingItemType(-953, "FHx Diagnosis", true, null, null, Color.Default);
	public static final CodingItemType IMAGING_EVENT = new CodingItemType(-1224, "IMAGING_EVENT", true, null, null, Color.Default);
}
