/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/MskJointMovementVo.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 medical.MskJointMovement business object (ID: 1023100022).
 */
public class MskJointMovementVo extends ims.medical.vo.MskJointMovementRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public MskJointMovementVo()
	{
	}
	public MskJointMovementVo(Integer id, int version)
	{
		super(id, version);
	}
	public MskJointMovementVo(ims.core.vo.beans.MskJointMovementVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.movetype = bean.getMoveType() == null ? null : ims.spinalinjuries.vo.lookups.MskJointsMovements.buildLookup(bean.getMoveType());
		this.movefinding = bean.getMoveFinding() == null ? null : ims.spinalinjuries.vo.lookups.MskBonesJointFindings.buildLookup(bean.getMoveFinding());
		this.movsor = bean.getMovSOR();
		this.moveor = bean.getMovEOR();
		this.qualitativerange = bean.getQualitativeRange() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange.buildLookup(bean.getQualitativeRange());
		this.limited = bean.getLimited() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementLimited.buildLookup(bean.getLimited());
		this.moveaction = bean.getMoveAction() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementAction.buildLookup(bean.getMoveAction());
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.MskJointMovementVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.movetype = bean.getMoveType() == null ? null : ims.spinalinjuries.vo.lookups.MskJointsMovements.buildLookup(bean.getMoveType());
		this.movefinding = bean.getMoveFinding() == null ? null : ims.spinalinjuries.vo.lookups.MskBonesJointFindings.buildLookup(bean.getMoveFinding());
		this.movsor = bean.getMovSOR();
		this.moveor = bean.getMovEOR();
		this.qualitativerange = bean.getQualitativeRange() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange.buildLookup(bean.getQualitativeRange());
		this.limited = bean.getLimited() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementLimited.buildLookup(bean.getLimited());
		this.moveaction = bean.getMoveAction() == null ? null : ims.spinalinjuries.vo.lookups.RangeOfMovementAction.buildLookup(bean.getMoveAction());
		this.sysinfo = bean.getSysInfo() == null ? null : bean.getSysInfo().buildSystemInformation();
	}
	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.MskJointMovementVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.MskJointMovementVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.MskJointMovementVoBean();
			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("MOVETYPE"))
			return getMoveType();
		if(fieldName.equals("MOVEFINDING"))
			return getMoveFinding();
		if(fieldName.equals("MOVSOR"))
			return getMovSOR();
		if(fieldName.equals("MOVEOR"))
			return getMovEOR();
		if(fieldName.equals("QUALITATIVERANGE"))
			return getQualitativeRange();
		if(fieldName.equals("LIMITED"))
			return getLimited();
		if(fieldName.equals("MOVEACTION"))
			return getMoveAction();
		if(fieldName.equals("SYSINFO"))
			return getSysInfo();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getMoveTypeIsNotNull()
	{
		return this.movetype != null;
	}
	public ims.spinalinjuries.vo.lookups.MskJointsMovements getMoveType()
	{
		return this.movetype;
	}
	public void setMoveType(ims.spinalinjuries.vo.lookups.MskJointsMovements value)
	{
		this.isValidated = false;
		this.movetype = value;
	}
	public boolean getMoveFindingIsNotNull()
	{
		return this.movefinding != null;
	}
	public ims.spinalinjuries.vo.lookups.MskBonesJointFindings getMoveFinding()
	{
		return this.movefinding;
	}
	public void setMoveFinding(ims.spinalinjuries.vo.lookups.MskBonesJointFindings value)
	{
		this.isValidated = false;
		this.movefinding = value;
	}
	public boolean getMovSORIsNotNull()
	{
		return this.movsor != null;
	}
	public Integer getMovSOR()
	{
		return this.movsor;
	}
	public void setMovSOR(Integer value)
	{
		this.isValidated = false;
		this.movsor = value;
	}
	public boolean getMovEORIsNotNull()
	{
		return this.moveor != null;
	}
	public Integer getMovEOR()
	{
		return this.moveor;
	}
	public void setMovEOR(Integer value)
	{
		this.isValidated = false;
		this.moveor = value;
	}
	public boolean getQualitativeRangeIsNotNull()
	{
		return this.qualitativerange != null;
	}
	public ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange getQualitativeRange()
	{
		return this.qualitativerange;
	}
	public void setQualitativeRange(ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange value)
	{
		this.isValidated = false;
		this.qualitativerange = value;
	}
	public boolean getLimitedIsNotNull()
	{
		return this.limited != null;
	}
	public ims.spinalinjuries.vo.lookups.RangeOfMovementLimited getLimited()
	{
		return this.limited;
	}
	public void setLimited(ims.spinalinjuries.vo.lookups.RangeOfMovementLimited value)
	{
		this.isValidated = false;
		this.limited = value;
	}
	public boolean getMoveActionIsNotNull()
	{
		return this.moveaction != null;
	}
	public ims.spinalinjuries.vo.lookups.RangeOfMovementAction getMoveAction()
	{
		return this.moveaction;
	}
	public void setMoveAction(ims.spinalinjuries.vo.lookups.RangeOfMovementAction value)
	{
		this.isValidated = false;
		this.moveaction = value;
	}
	public boolean getSysInfoIsNotNull()
	{
		return this.sysinfo != null;
	}
	public ims.vo.SystemInformation getSysInfo()
	{
		return this.sysinfo;
	}
	public void setSysInfo(ims.vo.SystemInformation value)
	{
		this.isValidated = false;
		this.sysinfo = 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;
	
		MskJointMovementVo clone = new MskJointMovementVo(this.id, this.version);
		
		if(this.movetype == null)
			clone.movetype = null;
		else
			clone.movetype = (ims.spinalinjuries.vo.lookups.MskJointsMovements)this.movetype.clone();
		if(this.movefinding == null)
			clone.movefinding = null;
		else
			clone.movefinding = (ims.spinalinjuries.vo.lookups.MskBonesJointFindings)this.movefinding.clone();
		clone.movsor = this.movsor;
		clone.moveor = this.moveor;
		if(this.qualitativerange == null)
			clone.qualitativerange = null;
		else
			clone.qualitativerange = (ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange)this.qualitativerange.clone();
		if(this.limited == null)
			clone.limited = null;
		else
			clone.limited = (ims.spinalinjuries.vo.lookups.RangeOfMovementLimited)this.limited.clone();
		if(this.moveaction == null)
			clone.moveaction = null;
		else
			clone.moveaction = (ims.spinalinjuries.vo.lookups.RangeOfMovementAction)this.moveaction.clone();
		if(this.sysinfo == null)
			clone.sysinfo = null;
		else
			clone.sysinfo = (ims.vo.SystemInformation)this.sysinfo.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 (!(MskJointMovementVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A MskJointMovementVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		MskJointMovementVo compareObj = (MskJointMovementVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getMoveAction() == null && compareObj.getMoveAction() != null)
				return -1;
			if(this.getMoveAction() != null && compareObj.getMoveAction() == null)
				return 1;
			if(this.getMoveAction() != null && compareObj.getMoveAction() != null)
				retVal = this.getMoveAction().compareTo(compareObj.getMoveAction());
		}
		if (retVal == 0)
		{
			if(this.getMoveType() == null && compareObj.getMoveType() != null)
				return -1;
			if(this.getMoveType() != null && compareObj.getMoveType() == null)
				return 1;
			if(this.getMoveType() != null && compareObj.getMoveType() != null)
				retVal = this.getMoveType().compareTo(compareObj.getMoveType());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.movetype != null)
			count++;
		if(this.movefinding != null)
			count++;
		if(this.movsor != null)
			count++;
		if(this.moveor != null)
			count++;
		if(this.qualitativerange != null)
			count++;
		if(this.limited != null)
			count++;
		if(this.moveaction != null)
			count++;
		if(this.sysinfo != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected ims.spinalinjuries.vo.lookups.MskJointsMovements movetype;
	protected ims.spinalinjuries.vo.lookups.MskBonesJointFindings movefinding;
	protected Integer movsor;
	protected Integer moveor;
	protected ims.spinalinjuries.vo.lookups.RangeOfMovementQualitativeRange qualitativerange;
	protected ims.spinalinjuries.vo.lookups.RangeOfMovementLimited limited;
	protected ims.spinalinjuries.vo.lookups.RangeOfMovementAction moveaction;
	protected ims.vo.SystemInformation sysinfo;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
