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

/**
 * Linked to Oncology.PatAction business object (ID: 1105100038).
 */
public class PatTreatPlanActionLiteVo extends ims.oncology.vo.PatActionRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PatTreatPlanActionLiteVo()
	{
	}
	public PatTreatPlanActionLiteVo(Integer id, int version)
	{
		super(id, version);
	}
	public PatTreatPlanActionLiteVo(ims.ccosched.vo.beans.PatTreatPlanActionLiteVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		// Interface field type not supported.
		this.action = bean.getAction() == null ? null : bean.getAction().buildVo();
		this.activity = bean.getActivity() == null ? null : bean.getActivity().buildVo();
		this.activitygroup = bean.getActivityGroup() == null ? null : new ims.dto_move.vo.ActivityGroupRefVo(new Integer(bean.getActivityGroup().getId()), bean.getActivityGroup().getVersion());
		this.plannedregime = bean.getPlannedRegime() == null ? null : ims.oncology.vo.lookups.RegimenAcronym.buildLookup(bean.getPlannedRegime());
		this.groupsitetech = ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection.buildFromBeanCollection(bean.getGroupSiteTech());
		this.active = bean.getActive();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.ccosched.vo.beans.PatTreatPlanActionLiteVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		// Interface field type not supported.
		this.action = bean.getAction() == null ? null : bean.getAction().buildVo(map);
		this.activity = bean.getActivity() == null ? null : bean.getActivity().buildVo(map);
		this.activitygroup = bean.getActivityGroup() == null ? null : new ims.dto_move.vo.ActivityGroupRefVo(new Integer(bean.getActivityGroup().getId()), bean.getActivityGroup().getVersion());
		this.plannedregime = bean.getPlannedRegime() == null ? null : ims.oncology.vo.lookups.RegimenAcronym.buildLookup(bean.getPlannedRegime());
		this.groupsitetech = ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection.buildFromBeanCollection(bean.getGroupSiteTech());
		this.active = bean.getActive();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.ccosched.vo.beans.PatTreatPlanActionLiteVoBean bean = null;
		if(map != null)
			bean = (ims.ccosched.vo.beans.PatTreatPlanActionLiteVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.ccosched.vo.beans.PatTreatPlanActionLiteVoBean();
			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("TREATINGCONSULTANT"))
			return getTreatingConsultant();
		if(fieldName.equals("ACTION"))
			return getAction();
		if(fieldName.equals("ACTIVITY"))
			return getActivity();
		if(fieldName.equals("ACTIVITYGROUP"))
			return getActivityGroup();
		if(fieldName.equals("PLANNEDREGIME"))
			return getPlannedRegime();
		if(fieldName.equals("GROUPSITETECH"))
			return getGroupSiteTech();
		if(fieldName.equals("ACTIVE"))
			return getActive();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getTreatingConsultantIsNotNull()
	{
		return this.treatingconsultant != null;
	}
	public ims.vo.interfaces.IMos getTreatingConsultant()
	{
		return this.treatingconsultant;
	}
	public void setTreatingConsultant(ims.vo.interfaces.IMos value)
	{
		this.isValidated = false;
		this.treatingconsultant = (ims.core.vo.Hcp)value;
	}
	public boolean getActionIsNotNull()
	{
		return this.action != null;
	}
	public ims.dtomove.vo.ActivityActionVo getAction()
	{
		return this.action;
	}
	public void setAction(ims.dtomove.vo.ActivityActionVo value)
	{
		this.isValidated = false;
		this.action = value;
	}
	public boolean getActivityIsNotNull()
	{
		return this.activity != null;
	}
	public ims.dtomove.vo.SchedActivityVo getActivity()
	{
		return this.activity;
	}
	public void setActivity(ims.dtomove.vo.SchedActivityVo value)
	{
		this.isValidated = false;
		this.activity = value;
	}
	public boolean getActivityGroupIsNotNull()
	{
		return this.activitygroup != null;
	}
	public ims.dto_move.vo.ActivityGroupRefVo getActivityGroup()
	{
		return this.activitygroup;
	}
	public void setActivityGroup(ims.dto_move.vo.ActivityGroupRefVo value)
	{
		this.isValidated = false;
		this.activitygroup = value;
	}
	public boolean getPlannedRegimeIsNotNull()
	{
		return this.plannedregime != null;
	}
	public ims.oncology.vo.lookups.RegimenAcronym getPlannedRegime()
	{
		return this.plannedregime;
	}
	public void setPlannedRegime(ims.oncology.vo.lookups.RegimenAcronym value)
	{
		this.isValidated = false;
		this.plannedregime = value;
	}
	public boolean getGroupSiteTechIsNotNull()
	{
		return this.groupsitetech != null;
	}
	public ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection getGroupSiteTech()
	{
		return this.groupsitetech;
	}
	public void setGroupSiteTech(ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection value)
	{
		this.isValidated = false;
		this.groupsitetech = value;
	}
	public boolean getActiveIsNotNull()
	{
		return this.active != null;
	}
	public Boolean getActive()
	{
		return this.active;
	}
	public void setActive(Boolean value)
	{
		this.isValidated = false;
		this.active = 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;
	
		PatTreatPlanActionLiteVo clone = new PatTreatPlanActionLiteVo(this.id, this.version);
		
		clone.treatingconsultant = this.treatingconsultant;
		if(this.action == null)
			clone.action = null;
		else
			clone.action = (ims.dtomove.vo.ActivityActionVo)this.action.clone();
		if(this.activity == null)
			clone.activity = null;
		else
			clone.activity = (ims.dtomove.vo.SchedActivityVo)this.activity.clone();
		clone.activitygroup = this.activitygroup;
		if(this.plannedregime == null)
			clone.plannedregime = null;
		else
			clone.plannedregime = (ims.oncology.vo.lookups.RegimenAcronym)this.plannedregime.clone();
		if(this.groupsitetech == null)
			clone.groupsitetech = null;
		else
			clone.groupsitetech = (ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection)this.groupsitetech.clone();
		clone.active = this.active;
		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 (!(PatTreatPlanActionLiteVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PatTreatPlanActionLiteVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PatTreatPlanActionLiteVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PatTreatPlanActionLiteVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.treatingconsultant != null)
			count++;
		if(this.action != null)
			count++;
		if(this.activity != null)
			count++;
		if(this.activitygroup != null)
			count++;
		if(this.plannedregime != null)
			count++;
		if(this.groupsitetech != null)
			count++;
		if(this.active != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 7;
	}
	protected ims.core.vo.Hcp treatingconsultant;
	protected ims.dtomove.vo.ActivityActionVo action;
	protected ims.dtomove.vo.SchedActivityVo activity;
	protected ims.dto_move.vo.ActivityGroupRefVo activitygroup;
	protected ims.oncology.vo.lookups.RegimenAcronym plannedregime;
	protected ims.ccosched.vo.PatTrPlanGroupSiteTechVoCollection groupsitetech;
	protected Boolean active;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
