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

/**
 * Linked to correspondence.configuration.NoLetterIsRequired business object (ID: 1053100007).
 */
public class NoLetterIsRequiredVo extends ims.correspondence.configuration.vo.NoLetterIsRequiredRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public NoLetterIsRequiredVo()
	{
	}
	public NoLetterIsRequiredVo(Integer id, int version)
	{
		super(id, version);
	}
	public NoLetterIsRequiredVo(ims.correspondence.vo.beans.NoLetterIsRequiredVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.consultants = ims.core.vo.MedicLiteVoCollection.buildFromBeanCollection(bean.getConsultants());
		this.specialties = ims.core.vo.lookups.SpecialtyCollection.buildFromBeanCollection(bean.getSpecialties());
		this.newclinics = ims.core.vo.ClinicLiteVoCollection.buildFromBeanCollection(bean.getNewClinics());
		this.reviewclinics = ims.core.vo.ClinicLiteVoCollection.buildFromBeanCollection(bean.getReviewClinics());
		this.isactive = bean.getIsActive();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.correspondence.vo.beans.NoLetterIsRequiredVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.consultants = ims.core.vo.MedicLiteVoCollection.buildFromBeanCollection(bean.getConsultants());
		this.specialties = ims.core.vo.lookups.SpecialtyCollection.buildFromBeanCollection(bean.getSpecialties());
		this.newclinics = ims.core.vo.ClinicLiteVoCollection.buildFromBeanCollection(bean.getNewClinics());
		this.reviewclinics = ims.core.vo.ClinicLiteVoCollection.buildFromBeanCollection(bean.getReviewClinics());
		this.isactive = bean.getIsActive();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.correspondence.vo.beans.NoLetterIsRequiredVoBean bean = null;
		if(map != null)
			bean = (ims.correspondence.vo.beans.NoLetterIsRequiredVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.correspondence.vo.beans.NoLetterIsRequiredVoBean();
			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("CONSULTANTS"))
			return getConsultants();
		if(fieldName.equals("SPECIALTIES"))
			return getSpecialties();
		if(fieldName.equals("NEWCLINICS"))
			return getNewClinics();
		if(fieldName.equals("REVIEWCLINICS"))
			return getReviewClinics();
		if(fieldName.equals("ISACTIVE"))
			return getIsActive();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getConsultantsIsNotNull()
	{
		return this.consultants != null;
	}
	public ims.core.vo.MedicLiteVoCollection getConsultants()
	{
		return this.consultants;
	}
	public void setConsultants(ims.core.vo.MedicLiteVoCollection value)
	{
		this.isValidated = false;
		this.consultants = value;
	}
	public boolean getSpecialtiesIsNotNull()
	{
		return this.specialties != null;
	}
	public ims.core.vo.lookups.SpecialtyCollection getSpecialties()
	{
		return this.specialties;
	}
	public void setSpecialties(ims.core.vo.lookups.SpecialtyCollection value)
	{
		this.isValidated = false;
		this.specialties = value;
	}
	public boolean getNewClinicsIsNotNull()
	{
		return this.newclinics != null;
	}
	public ims.core.vo.ClinicLiteVoCollection getNewClinics()
	{
		return this.newclinics;
	}
	public void setNewClinics(ims.core.vo.ClinicLiteVoCollection value)
	{
		this.isValidated = false;
		this.newclinics = value;
	}
	public boolean getReviewClinicsIsNotNull()
	{
		return this.reviewclinics != null;
	}
	public ims.core.vo.ClinicLiteVoCollection getReviewClinics()
	{
		return this.reviewclinics;
	}
	public void setReviewClinics(ims.core.vo.ClinicLiteVoCollection value)
	{
		this.isValidated = false;
		this.reviewclinics = value;
	}
	public boolean getIsActiveIsNotNull()
	{
		return this.isactive != null;
	}
	public Boolean getIsActive()
	{
		return this.isactive;
	}
	public void setIsActive(Boolean value)
	{
		this.isValidated = false;
		this.isactive = 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.isactive == null)
			listOfErrors.add("isActive 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;
	
		NoLetterIsRequiredVo clone = new NoLetterIsRequiredVo(this.id, this.version);
		
		if(this.consultants == null)
			clone.consultants = null;
		else
			clone.consultants = (ims.core.vo.MedicLiteVoCollection)this.consultants.clone();
		if(this.specialties == null)
			clone.specialties = null;
		else
			clone.specialties = (ims.core.vo.lookups.SpecialtyCollection)this.specialties.clone();
		if(this.newclinics == null)
			clone.newclinics = null;
		else
			clone.newclinics = (ims.core.vo.ClinicLiteVoCollection)this.newclinics.clone();
		if(this.reviewclinics == null)
			clone.reviewclinics = null;
		else
			clone.reviewclinics = (ims.core.vo.ClinicLiteVoCollection)this.reviewclinics.clone();
		clone.isactive = this.isactive;
		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 (!(NoLetterIsRequiredVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A NoLetterIsRequiredVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		NoLetterIsRequiredVo compareObj = (NoLetterIsRequiredVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getID_NoLetterIsRequired() == null && compareObj.getID_NoLetterIsRequired() != null)
				return -1;
			if(this.getID_NoLetterIsRequired() != null && compareObj.getID_NoLetterIsRequired() == null)
				return 1;
			if(this.getID_NoLetterIsRequired() != null && compareObj.getID_NoLetterIsRequired() != null)
				retVal = this.getID_NoLetterIsRequired().compareTo(compareObj.getID_NoLetterIsRequired());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.consultants != null)
			count++;
		if(this.specialties != null)
			count++;
		if(this.newclinics != null)
			count++;
		if(this.reviewclinics != null)
			count++;
		if(this.isactive != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 5;
	}
	protected ims.core.vo.MedicLiteVoCollection consultants;
	protected ims.core.vo.lookups.SpecialtyCollection specialties;
	protected ims.core.vo.ClinicLiteVoCollection newclinics;
	protected ims.core.vo.ClinicLiteVoCollection reviewclinics;
	protected Boolean isactive;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
