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

	public ClinicalNotesListVo()
	{
	}
	public ClinicalNotesListVo(Integer id, int version)
	{
		super(id, version);
	}
	public ClinicalNotesListVo(ims.core.vo.beans.ClinicalNotesListVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.clinicalnote = bean.getClinicalNote();
		this.notetype = bean.getNoteType() == null ? null : ims.core.vo.lookups.ClinicalNoteType.buildLookup(bean.getNoteType());
		this.discipline = bean.getDiscipline() == null ? null : ims.core.vo.lookups.HcpDisType.buildLookup(bean.getDiscipline());
		this.clinicalcontact = bean.getClinicalContact() == null ? null : new ims.core.admin.vo.ClinicalContactRefVo(new Integer(bean.getClinicalContact().getId()), bean.getClinicalContact().getVersion());
		this.authoringinfo = bean.getAuthoringInfo() == null ? null : bean.getAuthoringInfo().buildVo();
		this.isderivednote = bean.getIsDerivedNote();
		this.forreview = bean.getForReview();
		this.forreviewdiscipline = bean.getForReviewDiscipline() == null ? null : ims.core.vo.lookups.HcpDisType.buildLookup(bean.getForReviewDiscipline());
		this.reviewinghcp = bean.getReviewingHCP() == null ? null : bean.getReviewingHCP().buildVo();
		this.reviewingdatetime = bean.getReviewingDateTime() == null ? null : bean.getReviewingDateTime().buildDateTime();
		this.currentstatus = bean.getCurrentStatus() == null ? null : bean.getCurrentStatus().buildVo();
		this.iscorrected = bean.getIsCorrected();
		this.istranscribed = bean.getIsTranscribed();
		this.sourceofnote = bean.getSourceOfNote() == null ? null : ims.core.vo.lookups.SourceOfNote.buildLookup(bean.getSourceOfNote());
		this.recordinguser = bean.getRecordingUser() == null ? null : bean.getRecordingUser().buildVo();
		this.recordingdatetime = bean.getRecordingDateTime() == null ? null : bean.getRecordingDateTime().buildDateTime();
		this.systeminfo = bean.getSystemInfo() == null ? null : bean.getSystemInfo().buildSystemInformation();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.ClinicalNotesListVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.clinicalnote = bean.getClinicalNote();
		this.notetype = bean.getNoteType() == null ? null : ims.core.vo.lookups.ClinicalNoteType.buildLookup(bean.getNoteType());
		this.discipline = bean.getDiscipline() == null ? null : ims.core.vo.lookups.HcpDisType.buildLookup(bean.getDiscipline());
		this.clinicalcontact = bean.getClinicalContact() == null ? null : new ims.core.admin.vo.ClinicalContactRefVo(new Integer(bean.getClinicalContact().getId()), bean.getClinicalContact().getVersion());
		this.authoringinfo = bean.getAuthoringInfo() == null ? null : bean.getAuthoringInfo().buildVo(map);
		this.isderivednote = bean.getIsDerivedNote();
		this.forreview = bean.getForReview();
		this.forreviewdiscipline = bean.getForReviewDiscipline() == null ? null : ims.core.vo.lookups.HcpDisType.buildLookup(bean.getForReviewDiscipline());
		this.reviewinghcp = bean.getReviewingHCP() == null ? null : bean.getReviewingHCP().buildVo(map);
		this.reviewingdatetime = bean.getReviewingDateTime() == null ? null : bean.getReviewingDateTime().buildDateTime();
		this.currentstatus = bean.getCurrentStatus() == null ? null : bean.getCurrentStatus().buildVo(map);
		this.iscorrected = bean.getIsCorrected();
		this.istranscribed = bean.getIsTranscribed();
		this.sourceofnote = bean.getSourceOfNote() == null ? null : ims.core.vo.lookups.SourceOfNote.buildLookup(bean.getSourceOfNote());
		this.recordinguser = bean.getRecordingUser() == null ? null : bean.getRecordingUser().buildVo(map);
		this.recordingdatetime = bean.getRecordingDateTime() == null ? null : bean.getRecordingDateTime().buildDateTime();
		this.systeminfo = bean.getSystemInfo() == null ? null : bean.getSystemInfo().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.ClinicalNotesListVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.ClinicalNotesListVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.ClinicalNotesListVoBean();
			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("NOTETYPE"))
			return getNoteType();
		if(fieldName.equals("DISCIPLINE"))
			return getDiscipline();
		if(fieldName.equals("CLINICALCONTACT"))
			return getClinicalContact();
		if(fieldName.equals("AUTHORINGINFO"))
			return getAuthoringInfo();
		if(fieldName.equals("ISDERIVEDNOTE"))
			return getIsDerivedNote();
		if(fieldName.equals("FORREVIEW"))
			return getForReview();
		if(fieldName.equals("FORREVIEWDISCIPLINE"))
			return getForReviewDiscipline();
		if(fieldName.equals("REVIEWINGHCP"))
			return getReviewingHCP();
		if(fieldName.equals("REVIEWINGDATETIME"))
			return getReviewingDateTime();
		if(fieldName.equals("CURRENTSTATUS"))
			return getCurrentStatus();
		if(fieldName.equals("ISCORRECTED"))
			return getIsCorrected();
		if(fieldName.equals("ISTRANSCRIBED"))
			return getIsTranscribed();
		if(fieldName.equals("SOURCEOFNOTE"))
			return getSourceOfNote();
		if(fieldName.equals("RECORDINGUSER"))
			return getRecordingUser();
		if(fieldName.equals("RECORDINGDATETIME"))
			return getRecordingDateTime();
		if(fieldName.equals("SYSTEMINFO"))
			return getSystemInfo();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getNoteTypeIsNotNull()
	{
		return this.notetype != null;
	}
	public ims.core.vo.lookups.ClinicalNoteType getNoteType()
	{
		return this.notetype;
	}
	public void setNoteType(ims.core.vo.lookups.ClinicalNoteType value)
	{
		this.isValidated = false;
		this.notetype = value;
	}
	public boolean getDisciplineIsNotNull()
	{
		return this.discipline != null;
	}
	public ims.core.vo.lookups.HcpDisType getDiscipline()
	{
		return this.discipline;
	}
	public void setDiscipline(ims.core.vo.lookups.HcpDisType value)
	{
		this.isValidated = false;
		this.discipline = value;
	}
	public boolean getClinicalContactIsNotNull()
	{
		return this.clinicalcontact != null;
	}
	public ims.core.admin.vo.ClinicalContactRefVo getClinicalContact()
	{
		return this.clinicalcontact;
	}
	public void setClinicalContact(ims.core.admin.vo.ClinicalContactRefVo value)
	{
		this.isValidated = false;
		this.clinicalcontact = value;
	}
	public boolean getAuthoringInfoIsNotNull()
	{
		return this.authoringinfo != null;
	}
	public ims.core.vo.AuthoringInformationVo getAuthoringInfo()
	{
		return this.authoringinfo;
	}
	public void setAuthoringInfo(ims.core.vo.AuthoringInformationVo value)
	{
		this.isValidated = false;
		this.authoringinfo = value;
	}
	public boolean getIsDerivedNoteIsNotNull()
	{
		return this.isderivednote != null;
	}
	public Boolean getIsDerivedNote()
	{
		return this.isderivednote;
	}
	public void setIsDerivedNote(Boolean value)
	{
		this.isValidated = false;
		this.isderivednote = value;
	}
	public boolean getForReviewIsNotNull()
	{
		return this.forreview != null;
	}
	public Boolean getForReview()
	{
		return this.forreview;
	}
	public void setForReview(Boolean value)
	{
		this.isValidated = false;
		this.forreview = value;
	}
	public boolean getForReviewDisciplineIsNotNull()
	{
		return this.forreviewdiscipline != null;
	}
	public ims.core.vo.lookups.HcpDisType getForReviewDiscipline()
	{
		return this.forreviewdiscipline;
	}
	public void setForReviewDiscipline(ims.core.vo.lookups.HcpDisType value)
	{
		this.isValidated = false;
		this.forreviewdiscipline = value;
	}
	public boolean getReviewingHCPIsNotNull()
	{
		return this.reviewinghcp != null;
	}
	public ims.core.vo.HcpLiteVo getReviewingHCP()
	{
		return this.reviewinghcp;
	}
	public void setReviewingHCP(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.reviewinghcp = value;
	}
	public boolean getReviewingDateTimeIsNotNull()
	{
		return this.reviewingdatetime != null;
	}
	public ims.framework.utils.DateTime getReviewingDateTime()
	{
		return this.reviewingdatetime;
	}
	public void setReviewingDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.reviewingdatetime = value;
	}
	public boolean getCurrentStatusIsNotNull()
	{
		return this.currentstatus != null;
	}
	public ims.core.vo.ClinicalNoteStatusVo getCurrentStatus()
	{
		return this.currentstatus;
	}
	public void setCurrentStatus(ims.core.vo.ClinicalNoteStatusVo value)
	{
		this.isValidated = false;
		this.currentstatus = value;
	}
	public boolean getIsCorrectedIsNotNull()
	{
		return this.iscorrected != null;
	}
	public Boolean getIsCorrected()
	{
		return this.iscorrected;
	}
	public void setIsCorrected(Boolean value)
	{
		this.isValidated = false;
		this.iscorrected = value;
	}
	public boolean getIsTranscribedIsNotNull()
	{
		return this.istranscribed != null;
	}
	public Boolean getIsTranscribed()
	{
		return this.istranscribed;
	}
	public void setIsTranscribed(Boolean value)
	{
		this.isValidated = false;
		this.istranscribed = value;
	}
	public boolean getSourceOfNoteIsNotNull()
	{
		return this.sourceofnote != null;
	}
	public ims.core.vo.lookups.SourceOfNote getSourceOfNote()
	{
		return this.sourceofnote;
	}
	public void setSourceOfNote(ims.core.vo.lookups.SourceOfNote value)
	{
		this.isValidated = false;
		this.sourceofnote = value;
	}
	public boolean getRecordingUserIsNotNull()
	{
		return this.recordinguser != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getRecordingUser()
	{
		return this.recordinguser;
	}
	public void setRecordingUser(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.recordinguser = value;
	}
	public boolean getRecordingDateTimeIsNotNull()
	{
		return this.recordingdatetime != null;
	}
	public ims.framework.utils.DateTime getRecordingDateTime()
	{
		return this.recordingdatetime;
	}
	public void setRecordingDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.recordingdatetime = value;
	}
	public boolean getSystemInfoIsNotNull()
	{
		return this.systeminfo != null;
	}
	public ims.vo.SystemInformation getSystemInfo()
	{
		return this.systeminfo;
	}
	public void setSystemInfo(ims.vo.SystemInformation value)
	{
		this.isValidated = false;
		this.systeminfo = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.authoringinfo != null)
		{
			if(!this.authoringinfo.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.currentstatus != null)
		{
			if(!this.currentstatus.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.clinicalnote == null || this.clinicalnote.length() == 0)
			listOfErrors.add("ClinicalNote is mandatory");
		if(this.authoringinfo == null)
			listOfErrors.add("'Authoring Info' is mandatory");
		if(this.authoringinfo != null)
		{
			String[] listOfOtherErrors = this.authoringinfo.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.isderivednote == null)
			listOfErrors.add("isDerivedNote is mandatory");
		if(this.currentstatus != null)
		{
			String[] listOfOtherErrors = this.currentstatus.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[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;
	
		ClinicalNotesListVo clone = new ClinicalNotesListVo(this.id, this.version);
		
		clone.clinicalnote = this.clinicalnote;
		if(this.notetype == null)
			clone.notetype = null;
		else
			clone.notetype = (ims.core.vo.lookups.ClinicalNoteType)this.notetype.clone();
		if(this.discipline == null)
			clone.discipline = null;
		else
			clone.discipline = (ims.core.vo.lookups.HcpDisType)this.discipline.clone();
		clone.clinicalcontact = this.clinicalcontact;
		if(this.authoringinfo == null)
			clone.authoringinfo = null;
		else
			clone.authoringinfo = (ims.core.vo.AuthoringInformationVo)this.authoringinfo.clone();
		clone.isderivednote = this.isderivednote;
		clone.forreview = this.forreview;
		if(this.forreviewdiscipline == null)
			clone.forreviewdiscipline = null;
		else
			clone.forreviewdiscipline = (ims.core.vo.lookups.HcpDisType)this.forreviewdiscipline.clone();
		if(this.reviewinghcp == null)
			clone.reviewinghcp = null;
		else
			clone.reviewinghcp = (ims.core.vo.HcpLiteVo)this.reviewinghcp.clone();
		if(this.reviewingdatetime == null)
			clone.reviewingdatetime = null;
		else
			clone.reviewingdatetime = (ims.framework.utils.DateTime)this.reviewingdatetime.clone();
		if(this.currentstatus == null)
			clone.currentstatus = null;
		else
			clone.currentstatus = (ims.core.vo.ClinicalNoteStatusVo)this.currentstatus.clone();
		clone.iscorrected = this.iscorrected;
		clone.istranscribed = this.istranscribed;
		if(this.sourceofnote == null)
			clone.sourceofnote = null;
		else
			clone.sourceofnote = (ims.core.vo.lookups.SourceOfNote)this.sourceofnote.clone();
		if(this.recordinguser == null)
			clone.recordinguser = null;
		else
			clone.recordinguser = (ims.core.vo.MemberOfStaffLiteVo)this.recordinguser.clone();
		if(this.recordingdatetime == null)
			clone.recordingdatetime = null;
		else
			clone.recordingdatetime = (ims.framework.utils.DateTime)this.recordingdatetime.clone();
		if(this.systeminfo == null)
			clone.systeminfo = null;
		else
			clone.systeminfo = (ims.vo.SystemInformation)this.systeminfo.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 (!(ClinicalNotesListVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ClinicalNotesListVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((ClinicalNotesListVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((ClinicalNotesListVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = super.countFieldsWithValue();
		if(this.notetype != null)
			count++;
		if(this.discipline != null)
			count++;
		if(this.clinicalcontact != null)
			count++;
		if(this.authoringinfo != null)
			count++;
		if(this.isderivednote != null)
			count++;
		if(this.forreview != null)
			count++;
		if(this.forreviewdiscipline != null)
			count++;
		if(this.reviewinghcp != null)
			count++;
		if(this.reviewingdatetime != null)
			count++;
		if(this.currentstatus != null)
			count++;
		if(this.iscorrected != null)
			count++;
		if(this.istranscribed != null)
			count++;
		if(this.sourceofnote != null)
			count++;
		if(this.recordinguser != null)
			count++;
		if(this.recordingdatetime != null)
			count++;
		if(this.systeminfo != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return super.countValueObjectFields() + 16;
	}
	protected ims.core.vo.lookups.ClinicalNoteType notetype;
	protected ims.core.vo.lookups.HcpDisType discipline;
	protected ims.core.admin.vo.ClinicalContactRefVo clinicalcontact;
	protected ims.core.vo.AuthoringInformationVo authoringinfo;
	protected Boolean isderivednote;
	protected Boolean forreview;
	protected ims.core.vo.lookups.HcpDisType forreviewdiscipline;
	protected ims.core.vo.HcpLiteVo reviewinghcp;
	protected ims.framework.utils.DateTime reviewingdatetime;
	protected ims.core.vo.ClinicalNoteStatusVo currentstatus;
	protected Boolean iscorrected;
	protected Boolean istranscribed;
	protected ims.core.vo.lookups.SourceOfNote sourceofnote;
	protected ims.core.vo.MemberOfStaffLiteVo recordinguser;
	protected ims.framework.utils.DateTime recordingdatetime;
	protected ims.vo.SystemInformation systeminfo;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
