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


public class SkinReviewSearchCriteriaVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public SkinReviewSearchCriteriaVo()
	{
	}
	public SkinReviewSearchCriteriaVo(ims.nursing.vo.beans.SkinReviewSearchCriteriaVoBean bean)
	{
		this.carecontext = bean.getCareContext() == null ? null : bean.getCareContext().buildVo();
		this.viewtype = bean.getViewType();
		this.assessment = bean.getAssessment() == null ? null : bean.getAssessment().buildVo();
		this.findings = bean.getFindings() == null ? null : bean.getFindings().buildVo();
		this.selectedcarecontext = bean.getSelectedCareContext() == null ? null : bean.getSelectedCareContext().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.nursing.vo.beans.SkinReviewSearchCriteriaVoBean bean)
	{
		this.carecontext = bean.getCareContext() == null ? null : bean.getCareContext().buildVo(map);
		this.viewtype = bean.getViewType();
		this.assessment = bean.getAssessment() == null ? null : bean.getAssessment().buildVo(map);
		this.findings = bean.getFindings() == null ? null : bean.getFindings().buildVo(map);
		this.selectedcarecontext = bean.getSelectedCareContext() == null ? null : bean.getSelectedCareContext().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.nursing.vo.beans.SkinReviewSearchCriteriaVoBean bean = null;
		if(map != null)
			bean = (ims.nursing.vo.beans.SkinReviewSearchCriteriaVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.nursing.vo.beans.SkinReviewSearchCriteriaVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getCareContextIsNotNull()
	{
		return this.carecontext != null;
	}
	public ims.core.vo.CareContextShortVo getCareContext()
	{
		return this.carecontext;
	}
	public void setCareContext(ims.core.vo.CareContextShortVo value)
	{
		this.isValidated = false;
		this.carecontext = value;
	}
	public boolean getViewTypeIsNotNull()
	{
		return this.viewtype != null;
	}
	public Integer getViewType()
	{
		return this.viewtype;
	}
	public void setViewType(Integer value)
	{
		this.isValidated = false;
		this.viewtype = value;
	}
	public boolean getAssessmentIsNotNull()
	{
		return this.assessment != null;
	}
	public ims.nursing.vo.SkinAssessment getAssessment()
	{
		return this.assessment;
	}
	public void setAssessment(ims.nursing.vo.SkinAssessment value)
	{
		this.isValidated = false;
		this.assessment = value;
	}
	public boolean getFindingsIsNotNull()
	{
		return this.findings != null;
	}
	public ims.nursing.vo.SkinAssessmentFindings getFindings()
	{
		return this.findings;
	}
	public void setFindings(ims.nursing.vo.SkinAssessmentFindings value)
	{
		this.isValidated = false;
		this.findings = value;
	}
	public boolean getSelectedCareContextIsNotNull()
	{
		return this.selectedcarecontext != null;
	}
	public ims.core.vo.CareContextShortVo getSelectedCareContext()
	{
		return this.selectedcarecontext;
	}
	public void setSelectedCareContext(ims.core.vo.CareContextShortVo value)
	{
		this.isValidated = false;
		this.selectedcarecontext = value;
	}
	public final String getIItemText()
	{
		return toString();
	}
	public final Integer getBoId() 
	{
		return null;
	}
	public final String getBoClassName()
	{
		return null;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.carecontext != null)
		{
			if(!this.carecontext.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.assessment != null)
		{
			if(!this.assessment.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.findings != null)
		{
			if(!this.findings.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.selectedcarecontext != null)
		{
			if(!this.selectedcarecontext.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.carecontext != null)
		{
			String[] listOfOtherErrors = this.carecontext.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.assessment != null)
		{
			String[] listOfOtherErrors = this.assessment.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.findings != null)
		{
			String[] listOfOtherErrors = this.findings.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.selectedcarecontext != null)
		{
			String[] listOfOtherErrors = this.selectedcarecontext.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[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 Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		SkinReviewSearchCriteriaVo clone = new SkinReviewSearchCriteriaVo();
		
		if(this.carecontext == null)
			clone.carecontext = null;
		else
			clone.carecontext = (ims.core.vo.CareContextShortVo)this.carecontext.clone();
		clone.viewtype = this.viewtype;
		if(this.assessment == null)
			clone.assessment = null;
		else
			clone.assessment = (ims.nursing.vo.SkinAssessment)this.assessment.clone();
		if(this.findings == null)
			clone.findings = null;
		else
			clone.findings = (ims.nursing.vo.SkinAssessmentFindings)this.findings.clone();
		if(this.selectedcarecontext == null)
			clone.selectedcarecontext = null;
		else
			clone.selectedcarecontext = (ims.core.vo.CareContextShortVo)this.selectedcarecontext.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 (!(SkinReviewSearchCriteriaVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A SkinReviewSearchCriteriaVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		SkinReviewSearchCriteriaVo compareObj = (SkinReviewSearchCriteriaVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getCareContext() == null && compareObj.getCareContext() != null)
				return -1;
			if(this.getCareContext() != null && compareObj.getCareContext() == null)
				return 1;
			if(this.getCareContext() != null && compareObj.getCareContext() != null)
				retVal = this.getCareContext().compareTo(compareObj.getCareContext());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.carecontext != null)
			count++;
		if(this.viewtype != null)
			count++;
		if(this.assessment != null)
			count++;
		if(this.findings != null)
			count++;
		if(this.selectedcarecontext != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 5;
	}
	protected ims.core.vo.CareContextShortVo carecontext;
	protected Integer viewtype;
	protected ims.nursing.vo.SkinAssessment assessment;
	protected ims.nursing.vo.SkinAssessmentFindings findings;
	protected ims.core.vo.CareContextShortVo selectedcarecontext;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
