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

/**
 * Linked to core.vitals.Lung Function Tests business object (ID: 1022100006).
 */
public class VSLungFunctionTestVo extends ims.core.vitals.vo.LungFunctionTestsRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public VSLungFunctionTestVo()
	{
	}
	public VSLungFunctionTestVo(Integer id, int version)
	{
		super(id, version);
	}
	public VSLungFunctionTestVo(ims.core.vo.beans.VSLungFunctionTestVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.peakflowpre = bean.getPeakFlowPre();
		this.peakflowpost = bean.getPeakFlowPost();
		this.timeinterval = bean.getTimeInterval();
		this.tidalvolume = bean.getTidalVolume();
		this.incentivespirometer = bean.getIncentiveSpirometer();
		this.totallungcapacity = bean.getTotalLungCapacity();
		this.functionalresidualcapacity = bean.getFunctionalResidualCapacity();
		this.forcedexpiratoryvolume = bean.getForcedExpiratoryVolume();
		this.forcedvitalcapacity = bean.getForcedVitalCapacity();
		this.minutevolume = bean.getMinuteVolume();
		this.vitalcapacity = bean.getVitalCapacity();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.VSLungFunctionTestVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.peakflowpre = bean.getPeakFlowPre();
		this.peakflowpost = bean.getPeakFlowPost();
		this.timeinterval = bean.getTimeInterval();
		this.tidalvolume = bean.getTidalVolume();
		this.incentivespirometer = bean.getIncentiveSpirometer();
		this.totallungcapacity = bean.getTotalLungCapacity();
		this.functionalresidualcapacity = bean.getFunctionalResidualCapacity();
		this.forcedexpiratoryvolume = bean.getForcedExpiratoryVolume();
		this.forcedvitalcapacity = bean.getForcedVitalCapacity();
		this.minutevolume = bean.getMinuteVolume();
		this.vitalcapacity = bean.getVitalCapacity();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.core.vo.beans.VSLungFunctionTestVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.VSLungFunctionTestVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.VSLungFunctionTestVoBean();
			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("PEAKFLOWPRE"))
			return getPeakFlowPre();
		if(fieldName.equals("PEAKFLOWPOST"))
			return getPeakFlowPost();
		if(fieldName.equals("TIMEINTERVAL"))
			return getTimeInterval();
		if(fieldName.equals("TIDALVOLUME"))
			return getTidalVolume();
		if(fieldName.equals("INCENTIVESPIROMETER"))
			return getIncentiveSpirometer();
		if(fieldName.equals("TOTALLUNGCAPACITY"))
			return getTotalLungCapacity();
		if(fieldName.equals("FUNCTIONALRESIDUALCAPACITY"))
			return getFunctionalResidualCapacity();
		if(fieldName.equals("FORCEDEXPIRATORYVOLUME"))
			return getForcedExpiratoryVolume();
		if(fieldName.equals("FORCEDVITALCAPACITY"))
			return getForcedVitalCapacity();
		if(fieldName.equals("MINUTEVOLUME"))
			return getMinuteVolume();
		if(fieldName.equals("VITALCAPACITY"))
			return getVitalCapacity();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPeakFlowPreIsNotNull()
	{
		return this.peakflowpre != null;
	}
	public Integer getPeakFlowPre()
	{
		return this.peakflowpre;
	}
	public void setPeakFlowPre(Integer value)
	{
		this.isValidated = false;
		this.peakflowpre = value;
	}
	public boolean getPeakFlowPostIsNotNull()
	{
		return this.peakflowpost != null;
	}
	public Integer getPeakFlowPost()
	{
		return this.peakflowpost;
	}
	public void setPeakFlowPost(Integer value)
	{
		this.isValidated = false;
		this.peakflowpost = value;
	}
	public boolean getTimeIntervalIsNotNull()
	{
		return this.timeinterval != null;
	}
	public Integer getTimeInterval()
	{
		return this.timeinterval;
	}
	public void setTimeInterval(Integer value)
	{
		this.isValidated = false;
		this.timeinterval = value;
	}
	public boolean getTidalVolumeIsNotNull()
	{
		return this.tidalvolume != null;
	}
	public Integer getTidalVolume()
	{
		return this.tidalvolume;
	}
	public void setTidalVolume(Integer value)
	{
		this.isValidated = false;
		this.tidalvolume = value;
	}
	public boolean getIncentiveSpirometerIsNotNull()
	{
		return this.incentivespirometer != null;
	}
	public Integer getIncentiveSpirometer()
	{
		return this.incentivespirometer;
	}
	public void setIncentiveSpirometer(Integer value)
	{
		this.isValidated = false;
		this.incentivespirometer = value;
	}
	public boolean getTotalLungCapacityIsNotNull()
	{
		return this.totallungcapacity != null;
	}
	public Integer getTotalLungCapacity()
	{
		return this.totallungcapacity;
	}
	public void setTotalLungCapacity(Integer value)
	{
		this.isValidated = false;
		this.totallungcapacity = value;
	}
	public boolean getFunctionalResidualCapacityIsNotNull()
	{
		return this.functionalresidualcapacity != null;
	}
	public Integer getFunctionalResidualCapacity()
	{
		return this.functionalresidualcapacity;
	}
	public void setFunctionalResidualCapacity(Integer value)
	{
		this.isValidated = false;
		this.functionalresidualcapacity = value;
	}
	public boolean getForcedExpiratoryVolumeIsNotNull()
	{
		return this.forcedexpiratoryvolume != null;
	}
	public Integer getForcedExpiratoryVolume()
	{
		return this.forcedexpiratoryvolume;
	}
	public void setForcedExpiratoryVolume(Integer value)
	{
		this.isValidated = false;
		this.forcedexpiratoryvolume = value;
	}
	public boolean getForcedVitalCapacityIsNotNull()
	{
		return this.forcedvitalcapacity != null;
	}
	public Integer getForcedVitalCapacity()
	{
		return this.forcedvitalcapacity;
	}
	public void setForcedVitalCapacity(Integer value)
	{
		this.isValidated = false;
		this.forcedvitalcapacity = value;
	}
	public boolean getMinuteVolumeIsNotNull()
	{
		return this.minutevolume != null;
	}
	public Integer getMinuteVolume()
	{
		return this.minutevolume;
	}
	public void setMinuteVolume(Integer value)
	{
		this.isValidated = false;
		this.minutevolume = value;
	}
	public boolean getVitalCapacityIsNotNull()
	{
		return this.vitalcapacity != null;
	}
	public Float getVitalCapacity()
	{
		return this.vitalcapacity;
	}
	public void setVitalCapacity(Float value)
	{
		this.isValidated = false;
		this.vitalcapacity = 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]);
			}
		}
		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;
	
		VSLungFunctionTestVo clone = new VSLungFunctionTestVo(this.id, this.version);
		
		clone.peakflowpre = this.peakflowpre;
		clone.peakflowpost = this.peakflowpost;
		clone.timeinterval = this.timeinterval;
		clone.tidalvolume = this.tidalvolume;
		clone.incentivespirometer = this.incentivespirometer;
		clone.totallungcapacity = this.totallungcapacity;
		clone.functionalresidualcapacity = this.functionalresidualcapacity;
		clone.forcedexpiratoryvolume = this.forcedexpiratoryvolume;
		clone.forcedvitalcapacity = this.forcedvitalcapacity;
		clone.minutevolume = this.minutevolume;
		clone.vitalcapacity = this.vitalcapacity;
		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 (!(VSLungFunctionTestVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A VSLungFunctionTestVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		VSLungFunctionTestVo compareObj = (VSLungFunctionTestVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getID_LungFunctionTests() == null && compareObj.getID_LungFunctionTests() != null)
				return -1;
			if(this.getID_LungFunctionTests() != null && compareObj.getID_LungFunctionTests() == null)
				return 1;
			if(this.getID_LungFunctionTests() != null && compareObj.getID_LungFunctionTests() != null)
				retVal = this.getID_LungFunctionTests().compareTo(compareObj.getID_LungFunctionTests());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.peakflowpre != null)
			count++;
		if(this.peakflowpost != null)
			count++;
		if(this.timeinterval != null)
			count++;
		if(this.tidalvolume != null)
			count++;
		if(this.incentivespirometer != null)
			count++;
		if(this.totallungcapacity != null)
			count++;
		if(this.functionalresidualcapacity != null)
			count++;
		if(this.forcedexpiratoryvolume != null)
			count++;
		if(this.forcedvitalcapacity != null)
			count++;
		if(this.minutevolume != null)
			count++;
		if(this.vitalcapacity != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 11;
	}
	protected Integer peakflowpre;
	protected Integer peakflowpost;
	protected Integer timeinterval;
	protected Integer tidalvolume;
	protected Integer incentivespirometer;
	protected Integer totallungcapacity;
	protected Integer functionalresidualcapacity;
	protected Integer forcedexpiratoryvolume;
	protected Integer forcedvitalcapacity;
	protected Integer minutevolume;
	protected Float vitalcapacity;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
