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

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

	public FollowUpLiteVo()
	{
	}
	public FollowUpLiteVo(Integer id, int version)
	{
		super(id, version);
	}
	public FollowUpLiteVo(ims.oncology.vo.beans.FollowUpLiteVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.assessmentdate = bean.getAssessmentDate() == null ? null : bean.getAssessmentDate().buildDate();
		this.patientfollowupstatus = bean.getPatientFollowUpStatus() == null ? null : ims.oncology.vo.lookups.FUPatientFollowUpStatus.buildLookup(bean.getPatientFollowUpStatus());
		this.treatmenttype = bean.getTreatmentType() == null ? null : ims.oncology.vo.lookups.FUTreatmentType.buildLookup(bean.getTreatmentType());
		this.primarytumourstatus = bean.getPrimaryTumourStatus() == null ? null : ims.oncology.vo.lookups.FUPrimaryTumourStatus.buildLookup(bean.getPrimaryTumourStatus());
		this.nodalstatus = bean.getNodalStatus() == null ? null : ims.oncology.vo.lookups.FUNodalStatus.buildLookup(bean.getNodalStatus());
		this.metastaticstatus = bean.getMetastaticStatus() == null ? null : ims.oncology.vo.lookups.FUMetastaticStatus.buildLookup(bean.getMetastaticStatus());
		this.markerresponsestatus = bean.getMarkerResponseStatus() == null ? null : ims.oncology.vo.lookups.FUMarkerResponseStatus.buildLookup(bean.getMarkerResponseStatus());
		this.performancestatus = bean.getPerformanceStatus() == null ? null : ims.oncology.vo.lookups.WHOPerformanceStatus.buildLookup(bean.getPerformanceStatus());
		this.seenby = bean.getSeenBy() == null ? null : bean.getSeenBy().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.oncology.vo.beans.FollowUpLiteVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.assessmentdate = bean.getAssessmentDate() == null ? null : bean.getAssessmentDate().buildDate();
		this.patientfollowupstatus = bean.getPatientFollowUpStatus() == null ? null : ims.oncology.vo.lookups.FUPatientFollowUpStatus.buildLookup(bean.getPatientFollowUpStatus());
		this.treatmenttype = bean.getTreatmentType() == null ? null : ims.oncology.vo.lookups.FUTreatmentType.buildLookup(bean.getTreatmentType());
		this.primarytumourstatus = bean.getPrimaryTumourStatus() == null ? null : ims.oncology.vo.lookups.FUPrimaryTumourStatus.buildLookup(bean.getPrimaryTumourStatus());
		this.nodalstatus = bean.getNodalStatus() == null ? null : ims.oncology.vo.lookups.FUNodalStatus.buildLookup(bean.getNodalStatus());
		this.metastaticstatus = bean.getMetastaticStatus() == null ? null : ims.oncology.vo.lookups.FUMetastaticStatus.buildLookup(bean.getMetastaticStatus());
		this.markerresponsestatus = bean.getMarkerResponseStatus() == null ? null : ims.oncology.vo.lookups.FUMarkerResponseStatus.buildLookup(bean.getMarkerResponseStatus());
		this.performancestatus = bean.getPerformanceStatus() == null ? null : ims.oncology.vo.lookups.WHOPerformanceStatus.buildLookup(bean.getPerformanceStatus());
		this.seenby = bean.getSeenBy() == null ? null : bean.getSeenBy().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.oncology.vo.beans.FollowUpLiteVoBean bean = null;
		if(map != null)
			bean = (ims.oncology.vo.beans.FollowUpLiteVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.oncology.vo.beans.FollowUpLiteVoBean();
			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("ASSESSMENTDATE"))
			return getAssessmentDate();
		if(fieldName.equals("PATIENTFOLLOWUPSTATUS"))
			return getPatientFollowUpStatus();
		if(fieldName.equals("TREATMENTTYPE"))
			return getTreatmentType();
		if(fieldName.equals("PRIMARYTUMOURSTATUS"))
			return getPrimaryTumourStatus();
		if(fieldName.equals("NODALSTATUS"))
			return getNodalStatus();
		if(fieldName.equals("METASTATICSTATUS"))
			return getMetastaticStatus();
		if(fieldName.equals("MARKERRESPONSESTATUS"))
			return getMarkerResponseStatus();
		if(fieldName.equals("PERFORMANCESTATUS"))
			return getPerformanceStatus();
		if(fieldName.equals("SEENBY"))
			return getSeenBy();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getAssessmentDateIsNotNull()
	{
		return this.assessmentdate != null;
	}
	public ims.framework.utils.Date getAssessmentDate()
	{
		return this.assessmentdate;
	}
	public void setAssessmentDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.assessmentdate = value;
	}
	public boolean getPatientFollowUpStatusIsNotNull()
	{
		return this.patientfollowupstatus != null;
	}
	public ims.oncology.vo.lookups.FUPatientFollowUpStatus getPatientFollowUpStatus()
	{
		return this.patientfollowupstatus;
	}
	public void setPatientFollowUpStatus(ims.oncology.vo.lookups.FUPatientFollowUpStatus value)
	{
		this.isValidated = false;
		this.patientfollowupstatus = value;
	}
	public boolean getTreatmentTypeIsNotNull()
	{
		return this.treatmenttype != null;
	}
	public ims.oncology.vo.lookups.FUTreatmentType getTreatmentType()
	{
		return this.treatmenttype;
	}
	public void setTreatmentType(ims.oncology.vo.lookups.FUTreatmentType value)
	{
		this.isValidated = false;
		this.treatmenttype = value;
	}
	public boolean getPrimaryTumourStatusIsNotNull()
	{
		return this.primarytumourstatus != null;
	}
	public ims.oncology.vo.lookups.FUPrimaryTumourStatus getPrimaryTumourStatus()
	{
		return this.primarytumourstatus;
	}
	public void setPrimaryTumourStatus(ims.oncology.vo.lookups.FUPrimaryTumourStatus value)
	{
		this.isValidated = false;
		this.primarytumourstatus = value;
	}
	public boolean getNodalStatusIsNotNull()
	{
		return this.nodalstatus != null;
	}
	public ims.oncology.vo.lookups.FUNodalStatus getNodalStatus()
	{
		return this.nodalstatus;
	}
	public void setNodalStatus(ims.oncology.vo.lookups.FUNodalStatus value)
	{
		this.isValidated = false;
		this.nodalstatus = value;
	}
	public boolean getMetastaticStatusIsNotNull()
	{
		return this.metastaticstatus != null;
	}
	public ims.oncology.vo.lookups.FUMetastaticStatus getMetastaticStatus()
	{
		return this.metastaticstatus;
	}
	public void setMetastaticStatus(ims.oncology.vo.lookups.FUMetastaticStatus value)
	{
		this.isValidated = false;
		this.metastaticstatus = value;
	}
	public boolean getMarkerResponseStatusIsNotNull()
	{
		return this.markerresponsestatus != null;
	}
	public ims.oncology.vo.lookups.FUMarkerResponseStatus getMarkerResponseStatus()
	{
		return this.markerresponsestatus;
	}
	public void setMarkerResponseStatus(ims.oncology.vo.lookups.FUMarkerResponseStatus value)
	{
		this.isValidated = false;
		this.markerresponsestatus = value;
	}
	public boolean getPerformanceStatusIsNotNull()
	{
		return this.performancestatus != null;
	}
	public ims.oncology.vo.lookups.WHOPerformanceStatus getPerformanceStatus()
	{
		return this.performancestatus;
	}
	public void setPerformanceStatus(ims.oncology.vo.lookups.WHOPerformanceStatus value)
	{
		this.isValidated = false;
		this.performancestatus = value;
	}
	public boolean getSeenByIsNotNull()
	{
		return this.seenby != null;
	}
	public ims.core.vo.HcpLiteVo getSeenBy()
	{
		return this.seenby;
	}
	public void setSeenBy(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.seenby = 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.assessmentdate == null)
			listOfErrors.add("Assessment Date is mandatory");
		if(this.seenby == null)
			listOfErrors.add("SeenBy 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;
	
		FollowUpLiteVo clone = new FollowUpLiteVo(this.id, this.version);
		
		if(this.assessmentdate == null)
			clone.assessmentdate = null;
		else
			clone.assessmentdate = (ims.framework.utils.Date)this.assessmentdate.clone();
		if(this.patientfollowupstatus == null)
			clone.patientfollowupstatus = null;
		else
			clone.patientfollowupstatus = (ims.oncology.vo.lookups.FUPatientFollowUpStatus)this.patientfollowupstatus.clone();
		if(this.treatmenttype == null)
			clone.treatmenttype = null;
		else
			clone.treatmenttype = (ims.oncology.vo.lookups.FUTreatmentType)this.treatmenttype.clone();
		if(this.primarytumourstatus == null)
			clone.primarytumourstatus = null;
		else
			clone.primarytumourstatus = (ims.oncology.vo.lookups.FUPrimaryTumourStatus)this.primarytumourstatus.clone();
		if(this.nodalstatus == null)
			clone.nodalstatus = null;
		else
			clone.nodalstatus = (ims.oncology.vo.lookups.FUNodalStatus)this.nodalstatus.clone();
		if(this.metastaticstatus == null)
			clone.metastaticstatus = null;
		else
			clone.metastaticstatus = (ims.oncology.vo.lookups.FUMetastaticStatus)this.metastaticstatus.clone();
		if(this.markerresponsestatus == null)
			clone.markerresponsestatus = null;
		else
			clone.markerresponsestatus = (ims.oncology.vo.lookups.FUMarkerResponseStatus)this.markerresponsestatus.clone();
		if(this.performancestatus == null)
			clone.performancestatus = null;
		else
			clone.performancestatus = (ims.oncology.vo.lookups.WHOPerformanceStatus)this.performancestatus.clone();
		if(this.seenby == null)
			clone.seenby = null;
		else
			clone.seenby = (ims.core.vo.HcpLiteVo)this.seenby.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 (!(FollowUpLiteVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A FollowUpLiteVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((FollowUpLiteVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((FollowUpLiteVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.assessmentdate != null)
			count++;
		if(this.patientfollowupstatus != null)
			count++;
		if(this.treatmenttype != null)
			count++;
		if(this.primarytumourstatus != null)
			count++;
		if(this.nodalstatus != null)
			count++;
		if(this.metastaticstatus != null)
			count++;
		if(this.markerresponsestatus != null)
			count++;
		if(this.performancestatus != null)
			count++;
		if(this.seenby != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 9;
	}
	protected ims.framework.utils.Date assessmentdate;
	protected ims.oncology.vo.lookups.FUPatientFollowUpStatus patientfollowupstatus;
	protected ims.oncology.vo.lookups.FUTreatmentType treatmenttype;
	protected ims.oncology.vo.lookups.FUPrimaryTumourStatus primarytumourstatus;
	protected ims.oncology.vo.lookups.FUNodalStatus nodalstatus;
	protected ims.oncology.vo.lookups.FUMetastaticStatus metastaticstatus;
	protected ims.oncology.vo.lookups.FUMarkerResponseStatus markerresponsestatus;
	protected ims.oncology.vo.lookups.WHOPerformanceStatus performancestatus;
	protected ims.core.vo.HcpLiteVo seenby;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
