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

	public WaitingTimesAdjustmentsAndReasonsVo()
	{
	}
	public WaitingTimesAdjustmentsAndReasonsVo(Integer id, int version)
	{
		super(id, version);
	}
	public WaitingTimesAdjustmentsAndReasonsVo(ims.oncology.vo.beans.WaitingTimesAdjustmentsAndReasonsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.adjreferralfirstseen = bean.getAdjReferralFirstSeen();
		this.reasreferralfirstseen = bean.getReasReferralFirstSeen() == null ? null : ims.oncology.vo.lookups.DateReferralDateFirstSeenReason.buildLookup(bean.getReasReferralFirstSeen());
		this.adjfirstseendectreat = bean.getAdjFirstSeenDecTreat();
		this.reasfirstseendectreat = bean.getReasFirstSeenDecTreat() == null ? null : ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas.buildLookup(bean.getReasFirstSeenDecTreat());
		this.adjdectreattreatment = bean.getAdjDecTreatTreatment();
		this.reasdectreattreatment = bean.getReasDecTreatTreatment() == null ? null : ims.oncology.vo.lookups.ReasDateDecTreatTreatment.buildLookup(bean.getReasDecTreatTreatment());
		this.delayreasreferraltreat = bean.getDelayReasReferralTreat() == null ? null : ims.oncology.vo.lookups.DelayReasReferralTreat.buildLookup(bean.getDelayReasReferralTreat());
		this.notesreferraltreat = bean.getNotesReferralTreat();
		this.delayreasdectreattreat = bean.getDelayReasDecTreatTreat() == null ? null : ims.oncology.vo.lookups.DelayReasDecTreatTreat.buildLookup(bean.getDelayReasDecTreatTreat());
		this.notesdectreattreat = bean.getNotesDecTreatTreat();
		this.episodeofcare = bean.getEpisodeofCare() == null ? null : new ims.core.admin.vo.EpisodeOfCareRefVo(new Integer(bean.getEpisodeofCare().getId()), bean.getEpisodeofCare().getVersion());
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.oncology.vo.beans.WaitingTimesAdjustmentsAndReasonsVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.carecontext = bean.getCareContext() == null ? null : new ims.core.admin.vo.CareContextRefVo(new Integer(bean.getCareContext().getId()), bean.getCareContext().getVersion());
		this.adjreferralfirstseen = bean.getAdjReferralFirstSeen();
		this.reasreferralfirstseen = bean.getReasReferralFirstSeen() == null ? null : ims.oncology.vo.lookups.DateReferralDateFirstSeenReason.buildLookup(bean.getReasReferralFirstSeen());
		this.adjfirstseendectreat = bean.getAdjFirstSeenDecTreat();
		this.reasfirstseendectreat = bean.getReasFirstSeenDecTreat() == null ? null : ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas.buildLookup(bean.getReasFirstSeenDecTreat());
		this.adjdectreattreatment = bean.getAdjDecTreatTreatment();
		this.reasdectreattreatment = bean.getReasDecTreatTreatment() == null ? null : ims.oncology.vo.lookups.ReasDateDecTreatTreatment.buildLookup(bean.getReasDecTreatTreatment());
		this.delayreasreferraltreat = bean.getDelayReasReferralTreat() == null ? null : ims.oncology.vo.lookups.DelayReasReferralTreat.buildLookup(bean.getDelayReasReferralTreat());
		this.notesreferraltreat = bean.getNotesReferralTreat();
		this.delayreasdectreattreat = bean.getDelayReasDecTreatTreat() == null ? null : ims.oncology.vo.lookups.DelayReasDecTreatTreat.buildLookup(bean.getDelayReasDecTreatTreat());
		this.notesdectreattreat = bean.getNotesDecTreatTreat();
		this.episodeofcare = bean.getEpisodeofCare() == null ? null : new ims.core.admin.vo.EpisodeOfCareRefVo(new Integer(bean.getEpisodeofCare().getId()), bean.getEpisodeofCare().getVersion());
	}
	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.WaitingTimesAdjustmentsAndReasonsVoBean bean = null;
		if(map != null)
			bean = (ims.oncology.vo.beans.WaitingTimesAdjustmentsAndReasonsVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.oncology.vo.beans.WaitingTimesAdjustmentsAndReasonsVoBean();
			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("CARECONTEXT"))
			return getCareContext();
		if(fieldName.equals("ADJREFERRALFIRSTSEEN"))
			return getAdjReferralFirstSeen();
		if(fieldName.equals("REASREFERRALFIRSTSEEN"))
			return getReasReferralFirstSeen();
		if(fieldName.equals("ADJFIRSTSEENDECTREAT"))
			return getAdjFirstSeenDecTreat();
		if(fieldName.equals("REASFIRSTSEENDECTREAT"))
			return getReasFirstSeenDecTreat();
		if(fieldName.equals("ADJDECTREATTREATMENT"))
			return getAdjDecTreatTreatment();
		if(fieldName.equals("REASDECTREATTREATMENT"))
			return getReasDecTreatTreatment();
		if(fieldName.equals("DELAYREASREFERRALTREAT"))
			return getDelayReasReferralTreat();
		if(fieldName.equals("NOTESREFERRALTREAT"))
			return getNotesReferralTreat();
		if(fieldName.equals("DELAYREASDECTREATTREAT"))
			return getDelayReasDecTreatTreat();
		if(fieldName.equals("NOTESDECTREATTREAT"))
			return getNotesDecTreatTreat();
		if(fieldName.equals("EPISODEOFCARE"))
			return getEpisodeofCare();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getCareContextIsNotNull()
	{
		return this.carecontext != null;
	}
	public ims.core.admin.vo.CareContextRefVo getCareContext()
	{
		return this.carecontext;
	}
	public void setCareContext(ims.core.admin.vo.CareContextRefVo value)
	{
		this.isValidated = false;
		this.carecontext = value;
	}
	public boolean getAdjReferralFirstSeenIsNotNull()
	{
		return this.adjreferralfirstseen != null;
	}
	public Integer getAdjReferralFirstSeen()
	{
		return this.adjreferralfirstseen;
	}
	public void setAdjReferralFirstSeen(Integer value)
	{
		this.isValidated = false;
		this.adjreferralfirstseen = value;
	}
	public boolean getReasReferralFirstSeenIsNotNull()
	{
		return this.reasreferralfirstseen != null;
	}
	public ims.oncology.vo.lookups.DateReferralDateFirstSeenReason getReasReferralFirstSeen()
	{
		return this.reasreferralfirstseen;
	}
	public void setReasReferralFirstSeen(ims.oncology.vo.lookups.DateReferralDateFirstSeenReason value)
	{
		this.isValidated = false;
		this.reasreferralfirstseen = value;
	}
	public boolean getAdjFirstSeenDecTreatIsNotNull()
	{
		return this.adjfirstseendectreat != null;
	}
	public Integer getAdjFirstSeenDecTreat()
	{
		return this.adjfirstseendectreat;
	}
	public void setAdjFirstSeenDecTreat(Integer value)
	{
		this.isValidated = false;
		this.adjfirstseendectreat = value;
	}
	public boolean getReasFirstSeenDecTreatIsNotNull()
	{
		return this.reasfirstseendectreat != null;
	}
	public ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas getReasFirstSeenDecTreat()
	{
		return this.reasfirstseendectreat;
	}
	public void setReasFirstSeenDecTreat(ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas value)
	{
		this.isValidated = false;
		this.reasfirstseendectreat = value;
	}
	public boolean getAdjDecTreatTreatmentIsNotNull()
	{
		return this.adjdectreattreatment != null;
	}
	public Integer getAdjDecTreatTreatment()
	{
		return this.adjdectreattreatment;
	}
	public void setAdjDecTreatTreatment(Integer value)
	{
		this.isValidated = false;
		this.adjdectreattreatment = value;
	}
	public boolean getReasDecTreatTreatmentIsNotNull()
	{
		return this.reasdectreattreatment != null;
	}
	public ims.oncology.vo.lookups.ReasDateDecTreatTreatment getReasDecTreatTreatment()
	{
		return this.reasdectreattreatment;
	}
	public void setReasDecTreatTreatment(ims.oncology.vo.lookups.ReasDateDecTreatTreatment value)
	{
		this.isValidated = false;
		this.reasdectreattreatment = value;
	}
	public boolean getDelayReasReferralTreatIsNotNull()
	{
		return this.delayreasreferraltreat != null;
	}
	public ims.oncology.vo.lookups.DelayReasReferralTreat getDelayReasReferralTreat()
	{
		return this.delayreasreferraltreat;
	}
	public void setDelayReasReferralTreat(ims.oncology.vo.lookups.DelayReasReferralTreat value)
	{
		this.isValidated = false;
		this.delayreasreferraltreat = value;
	}
	public boolean getNotesReferralTreatIsNotNull()
	{
		return this.notesreferraltreat != null;
	}
	public String getNotesReferralTreat()
	{
		return this.notesreferraltreat;
	}
	public static int getNotesReferralTreatMaxLength()
	{
		return 255;
	}
	public void setNotesReferralTreat(String value)
	{
		this.isValidated = false;
		this.notesreferraltreat = value;
	}
	public boolean getDelayReasDecTreatTreatIsNotNull()
	{
		return this.delayreasdectreattreat != null;
	}
	public ims.oncology.vo.lookups.DelayReasDecTreatTreat getDelayReasDecTreatTreat()
	{
		return this.delayreasdectreattreat;
	}
	public void setDelayReasDecTreatTreat(ims.oncology.vo.lookups.DelayReasDecTreatTreat value)
	{
		this.isValidated = false;
		this.delayreasdectreattreat = value;
	}
	public boolean getNotesDecTreatTreatIsNotNull()
	{
		return this.notesdectreattreat != null;
	}
	public String getNotesDecTreatTreat()
	{
		return this.notesdectreattreat;
	}
	public static int getNotesDecTreatTreatMaxLength()
	{
		return 255;
	}
	public void setNotesDecTreatTreat(String value)
	{
		this.isValidated = false;
		this.notesdectreattreat = value;
	}
	public boolean getEpisodeofCareIsNotNull()
	{
		return this.episodeofcare != null;
	}
	public ims.core.admin.vo.EpisodeOfCareRefVo getEpisodeofCare()
	{
		return this.episodeofcare;
	}
	public void setEpisodeofCare(ims.core.admin.vo.EpisodeOfCareRefVo value)
	{
		this.isValidated = false;
		this.episodeofcare = 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.notesreferraltreat != null)
			if(this.notesreferraltreat.length() > 255)
				listOfErrors.add("The length of the field [notesreferraltreat] in the value object [ims.oncology.vo.WaitingTimesAdjustmentsAndReasonsVo] is too big. It should be less or equal to 255");
		if(this.notesdectreattreat != null)
			if(this.notesdectreattreat.length() > 255)
				listOfErrors.add("The length of the field [notesdectreattreat] in the value object [ims.oncology.vo.WaitingTimesAdjustmentsAndReasonsVo] is too big. It should be less or equal to 255");
		if(this.episodeofcare == null)
			listOfErrors.add("EpisodeofCare 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;
	
		WaitingTimesAdjustmentsAndReasonsVo clone = new WaitingTimesAdjustmentsAndReasonsVo(this.id, this.version);
		
		clone.carecontext = this.carecontext;
		clone.adjreferralfirstseen = this.adjreferralfirstseen;
		if(this.reasreferralfirstseen == null)
			clone.reasreferralfirstseen = null;
		else
			clone.reasreferralfirstseen = (ims.oncology.vo.lookups.DateReferralDateFirstSeenReason)this.reasreferralfirstseen.clone();
		clone.adjfirstseendectreat = this.adjfirstseendectreat;
		if(this.reasfirstseendectreat == null)
			clone.reasfirstseendectreat = null;
		else
			clone.reasfirstseendectreat = (ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas)this.reasfirstseendectreat.clone();
		clone.adjdectreattreatment = this.adjdectreattreatment;
		if(this.reasdectreattreatment == null)
			clone.reasdectreattreatment = null;
		else
			clone.reasdectreattreatment = (ims.oncology.vo.lookups.ReasDateDecTreatTreatment)this.reasdectreattreatment.clone();
		if(this.delayreasreferraltreat == null)
			clone.delayreasreferraltreat = null;
		else
			clone.delayreasreferraltreat = (ims.oncology.vo.lookups.DelayReasReferralTreat)this.delayreasreferraltreat.clone();
		clone.notesreferraltreat = this.notesreferraltreat;
		if(this.delayreasdectreattreat == null)
			clone.delayreasdectreattreat = null;
		else
			clone.delayreasdectreattreat = (ims.oncology.vo.lookups.DelayReasDecTreatTreat)this.delayreasdectreattreat.clone();
		clone.notesdectreattreat = this.notesdectreattreat;
		clone.episodeofcare = this.episodeofcare;
		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 (!(WaitingTimesAdjustmentsAndReasonsVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A WaitingTimesAdjustmentsAndReasonsVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((WaitingTimesAdjustmentsAndReasonsVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((WaitingTimesAdjustmentsAndReasonsVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.carecontext != null)
			count++;
		if(this.adjreferralfirstseen != null)
			count++;
		if(this.reasreferralfirstseen != null)
			count++;
		if(this.adjfirstseendectreat != null)
			count++;
		if(this.reasfirstseendectreat != null)
			count++;
		if(this.adjdectreattreatment != null)
			count++;
		if(this.reasdectreattreatment != null)
			count++;
		if(this.delayreasreferraltreat != null)
			count++;
		if(this.notesreferraltreat != null)
			count++;
		if(this.delayreasdectreattreat != null)
			count++;
		if(this.notesdectreattreat != null)
			count++;
		if(this.episodeofcare != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 12;
	}
	protected ims.core.admin.vo.CareContextRefVo carecontext;
	protected Integer adjreferralfirstseen;
	protected ims.oncology.vo.lookups.DateReferralDateFirstSeenReason reasreferralfirstseen;
	protected Integer adjfirstseendectreat;
	protected ims.oncology.vo.lookups.DateFirstSeenDateDecTreatReas reasfirstseendectreat;
	protected Integer adjdectreattreatment;
	protected ims.oncology.vo.lookups.ReasDateDecTreatTreatment reasdectreattreatment;
	protected ims.oncology.vo.lookups.DelayReasReferralTreat delayreasreferraltreat;
	protected String notesreferraltreat;
	protected ims.oncology.vo.lookups.DelayReasDecTreatTreat delayreasdectreattreat;
	protected String notesdectreattreat;
	protected ims.core.admin.vo.EpisodeOfCareRefVo episodeofcare;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
