gt: 		if (obj == null)
context: // This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5007.25751)
  // Copyright (C) 1995-2014 IMS MAXIMS. All rights reserved.
  // WARNING: DO NOT MODIFY the content of this file
  
  package ims.RefMan.vo;
  
  /**
   * Linked to core.patient.Patient business object (ID: 1001100000).
   */
  public class PatientForClinicalCodingWorklistVo extends ims.core.patient.vo.PatientRefVo implements ims.vo.ImsCloneable, Comparable
  {
  	private static final long serialVersionUID = 1L;
  
  	public PatientForClinicalCodingWorklistVo()
  	{
  	}
  	public PatientForClinicalCodingWorklistVo(Integer id, int version)
  	{
  		super(id, version);
  	}
  	public PatientForClinicalCodingWorklistVo(ims.RefMan.vo.beans.PatientForClinicalCodingWorklistVoBean bean)
  	{
  		this.id = bean.getId();
  		this.version = bean.getVersion();
  		this.name = bean.getName() == null ? null : bean.getName().buildVo();
  		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
  		this.identifiers = ims.core.vo.PatientIdCollection.buildFromBeanCollection(bean.getIdentifiers());
  	}
  	public void populate(ims.vo.ValueObjectBeanMap map, ims.RefMan.vo.beans.PatientForClinicalCodingWorklistVoBean bean)
  	{
  		this.id = bean.getId();
  		this.version = bean.getVersion();
  		this.name = bean.getName() == null ? null : bean.getName().buildVo(map);
  		this.sex = bean.getSex() == null ? null : ims.core.vo.lookups.Sex.buildLookup(bean.getSex());
  		this.identifiers = ims.core.vo.PatientIdCollection.buildFromBeanCollection(bean.getIdentifiers());
  	}
  	public ims.vo.ValueObjectBean getBean()
  	{
  		return this.getBean(new ims.vo.ValueObjectBeanMap());
  	}
  	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
  	{
  		ims.RefMan.vo.beans.PatientForClinicalCodingWorklistVoBean bean = null;
  		if(map != null)
  			bean = (ims.RefMan.vo.beans.PatientForClinicalCodingWorklistVoBean)map.getValueObjectBean(this);
  		if (bean == null)
  		{
  			bean = new ims.RefMan.vo.beans.PatientForClinicalCodingWorklistVoBean();
  			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("NAME"))
  			return getName();
  		if(fieldName.equals("SEX"))
  			return getSex();
  		if(fieldName.equals("IDENTIFIERS"))
  			return getIdentifiers();
  		return super.getFieldValueByFieldName(fieldName);
  	}
  	public boolean getNameIsNotNull()
  	{
  		return this.name != null;
  	}
  	public ims.core.vo.PersonName getName()
  	{
  		return this.name;
  	}
  	public void setName(ims.core.vo.PersonName value)
  	{
  		this.isValidated = false;
  		this.name = value;
  	}
  	public boolean getSexIsNotNull()
  	{
  		return this.sex != null;
  	}
  	public ims.core.vo.lookups.Sex getSex()
  	{
  		return this.sex;
  	}
  	public void setSex(ims.core.vo.lookups.Sex value)
  	{
  		this.isValidated = false;
  		this.sex = value;
  	}
  	public boolean getIdentifiersIsNotNull()
  	{
  		return this.identifiers != null;
  	}
  	public ims.core.vo.PatientIdCollection getIdentifiers()
  	{
  		return this.identifiers;
  	}
  	public void setIdentifiers(ims.core.vo.PatientIdCollection value)
  	{
  		this.isValidated = false;
  		this.identifiers = value;
  	}
  	/**
  	* getPatId
  	*/
  	public ims.core.vo.PatientId getPatId(ims.core.vo.lookups.PatIdType idType)
  	{
  		if (identifiers == null) return null;
  		for (int i = 0; i < identifiers.size(); i++)
  		{
  			ims.core.vo.PatientId id = identifiers.get(i);
  			if (id.getType().equals(idType))
  			{
  				return id;
  			}
  		}
  		return null;
  	}
  	
  	/**
  	* getHospnum
  	*/
  	public ims.core.vo.PatientId getHospnum()
  	{
  		return getPatId(ims.core.vo.lookups.PatIdType.HOSPNUM);
  	}
  	
  	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]);
  			}
  		}
  		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;
  	
  		PatientForClinicalCodingWorklistVo clone = new PatientForClinicalCodingWorklistVo(this.id, this.version);
  		
  		if(this.name == null)
  			clone.name = null;
  		else
  			clone.name = (ims.core.vo.PersonName)this.name.clone();
  		if(this.sex == null)
  			clone.sex = null;
  		else
  			clone.sex = (ims.core.vo.lookups.Sex)this.sex.clone();
  		if(this.identifiers == null)
  			clone.identifiers = null;
  		else
  			clone.identifiers = (ims.core.vo.PatientIdCollection)this.identifiers.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)
  	{
  