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

/**
 * Linked to Pathways.PatientPathwayJourney business object (ID: 1088100000).
 */
public class PatientPathwaysAwaitingValidationWorklistVo extends ims.pathways.vo.PatientPathwayJourneyRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PatientPathwaysAwaitingValidationWorklistVo()
	{
	}
	public PatientPathwaysAwaitingValidationWorklistVo(Integer id, int version)
	{
		super(id, version);
	}
	public PatientPathwaysAwaitingValidationWorklistVo(ims.pathways.vo.beans.PatientPathwaysAwaitingValidationWorklistVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo();
		this.pathway = bean.getPathway() == null ? null : bean.getPathway().buildVo();
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.currentstatus = bean.getCurrentStatus() == null ? null : bean.getCurrentStatus().buildVo();
		this.responsibleconsultant = bean.getResponsibleConsultant() == null ? null : bean.getResponsibleConsultant().buildVo();
		this.nextvalidationdate = bean.getNextValidationDate() == null ? null : bean.getNextValidationDate().buildDate();
		this.currentclock = bean.getCurrentClock() == null ? null : bean.getCurrentClock().buildVo();
		this.validationcompleteddt = bean.getValidationCompletedDT() == null ? null : bean.getValidationCompletedDT().buildDateTime();
		this.validationcompletedby = bean.getValidationCompletedBy() == null ? null : bean.getValidationCompletedBy().buildVo();
		this.lastvalidationdate = bean.getLastValidationDate() == null ? null : bean.getLastValidationDate().buildDate();
		this.service = bean.getService() == null ? null : bean.getService().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.pathways.vo.beans.PatientPathwaysAwaitingValidationWorklistVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.patient = bean.getPatient() == null ? null : bean.getPatient().buildVo(map);
		this.pathway = bean.getPathway() == null ? null : bean.getPathway().buildVo(map);
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.currentstatus = bean.getCurrentStatus() == null ? null : bean.getCurrentStatus().buildVo(map);
		this.responsibleconsultant = bean.getResponsibleConsultant() == null ? null : bean.getResponsibleConsultant().buildVo(map);
		this.nextvalidationdate = bean.getNextValidationDate() == null ? null : bean.getNextValidationDate().buildDate();
		this.currentclock = bean.getCurrentClock() == null ? null : bean.getCurrentClock().buildVo(map);
		this.validationcompleteddt = bean.getValidationCompletedDT() == null ? null : bean.getValidationCompletedDT().buildDateTime();
		this.validationcompletedby = bean.getValidationCompletedBy() == null ? null : bean.getValidationCompletedBy().buildVo(map);
		this.lastvalidationdate = bean.getLastValidationDate() == null ? null : bean.getLastValidationDate().buildDate();
		this.service = bean.getService() == null ? null : bean.getService().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.pathways.vo.beans.PatientPathwaysAwaitingValidationWorklistVoBean bean = null;
		if(map != null)
			bean = (ims.pathways.vo.beans.PatientPathwaysAwaitingValidationWorklistVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.pathways.vo.beans.PatientPathwaysAwaitingValidationWorklistVoBean();
			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("PATIENT"))
			return getPatient();
		if(fieldName.equals("PATHWAY"))
			return getPathway();
		if(fieldName.equals("STARTDATE"))
			return getStartDate();
		if(fieldName.equals("CURRENTSTATUS"))
			return getCurrentStatus();
		if(fieldName.equals("RESPONSIBLECONSULTANT"))
			return getResponsibleConsultant();
		if(fieldName.equals("NEXTVALIDATIONDATE"))
			return getNextValidationDate();
		if(fieldName.equals("CURRENTCLOCK"))
			return getCurrentClock();
		if(fieldName.equals("VALIDATIONCOMPLETEDDT"))
			return getValidationCompletedDT();
		if(fieldName.equals("VALIDATIONCOMPLETEDBY"))
			return getValidationCompletedBy();
		if(fieldName.equals("LASTVALIDATIONDATE"))
			return getLastValidationDate();
		if(fieldName.equals("SERVICE"))
			return getService();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getPatientIsNotNull()
	{
		return this.patient != null;
	}
	public ims.core.vo.PatientForPathwayAwaitingValidationWorklistVo getPatient()
	{
		return this.patient;
	}
	public void setPatient(ims.core.vo.PatientForPathwayAwaitingValidationWorklistVo value)
	{
		this.isValidated = false;
		this.patient = value;
	}
	public boolean getPathwayIsNotNull()
	{
		return this.pathway != null;
	}
	public ims.pathways.vo.PathwayForPatientPathwaysAwaitingValidationWorklistVo getPathway()
	{
		return this.pathway;
	}
	public void setPathway(ims.pathways.vo.PathwayForPatientPathwaysAwaitingValidationWorklistVo value)
	{
		this.isValidated = false;
		this.pathway = value;
	}
	public boolean getStartDateIsNotNull()
	{
		return this.startdate != null;
	}
	public ims.framework.utils.Date getStartDate()
	{
		return this.startdate;
	}
	public void setStartDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.startdate = value;
	}
	public boolean getCurrentStatusIsNotNull()
	{
		return this.currentstatus != null;
	}
	public ims.pathways.vo.PatientJourneyStatusVo getCurrentStatus()
	{
		return this.currentstatus;
	}
	public void setCurrentStatus(ims.pathways.vo.PatientJourneyStatusVo value)
	{
		this.isValidated = false;
		this.currentstatus = value;
	}
	public boolean getResponsibleConsultantIsNotNull()
	{
		return this.responsibleconsultant != null;
	}
	public ims.core.vo.HcpLiteVo getResponsibleConsultant()
	{
		return this.responsibleconsultant;
	}
	public void setResponsibleConsultant(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.responsibleconsultant = value;
	}
	public boolean getNextValidationDateIsNotNull()
	{
		return this.nextvalidationdate != null;
	}
	public ims.framework.utils.Date getNextValidationDate()
	{
		return this.nextvalidationdate;
	}
	public void setNextValidationDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.nextvalidationdate = value;
	}
	public boolean getCurrentClockIsNotNull()
	{
		return this.currentclock != null;
	}
	public ims.pathways.vo.PathwayClockForRTTCurrentStatusVo getCurrentClock()
	{
		return this.currentclock;
	}
	public void setCurrentClock(ims.pathways.vo.PathwayClockForRTTCurrentStatusVo value)
	{
		this.isValidated = false;
		this.currentclock = value;
	}
	public boolean getValidationCompletedDTIsNotNull()
	{
		return this.validationcompleteddt != null;
	}
	public ims.framework.utils.DateTime getValidationCompletedDT()
	{
		return this.validationcompleteddt;
	}
	public void setValidationCompletedDT(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.validationcompleteddt = value;
	}
	public boolean getValidationCompletedByIsNotNull()
	{
		return this.validationcompletedby != null;
	}
	public ims.core.vo.MemberOfStaffVo getValidationCompletedBy()
	{
		return this.validationcompletedby;
	}
	public void setValidationCompletedBy(ims.core.vo.MemberOfStaffVo value)
	{
		this.isValidated = false;
		this.validationcompletedby = value;
	}
	public boolean getLastValidationDateIsNotNull()
	{
		return this.lastvalidationdate != null;
	}
	public ims.framework.utils.Date getLastValidationDate()
	{
		return this.lastvalidationdate;
	}
	public void setLastValidationDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.lastvalidationdate = value;
	}
	public boolean getServiceIsNotNull()
	{
		return this.service != null;
	}
	public ims.core.vo.ServiceShortVo getService()
	{
		return this.service;
	}
	public void setService(ims.core.vo.ServiceShortVo value)
	{
		this.isValidated = false;
		this.service = 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.patient == null)
			listOfErrors.add("Patient is mandatory");
		if(this.pathway == null)
			listOfErrors.add("Pathway is mandatory");
		if(this.startdate == null)
			listOfErrors.add("StartDate is mandatory");
		if(this.currentstatus == null)
			listOfErrors.add("CurrentStatus 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;
	
		PatientPathwaysAwaitingValidationWorklistVo clone = new PatientPathwaysAwaitingValidationWorklistVo(this.id, this.version);
		
		if(this.patient == null)
			clone.patient = null;
		else
			clone.patient = (ims.core.vo.PatientForPathwayAwaitingValidationWorklistVo)this.patient.clone();
		if(this.pathway == null)
			clone.pathway = null;
		else
			clone.pathway = (ims.pathways.vo.PathwayForPatientPathwaysAwaitingValidationWorklistVo)this.pathway.clone();
		if(this.startdate == null)
			clone.startdate = null;
		else
			clone.startdate = (ims.framework.utils.Date)this.startdate.clone();
		if(this.currentstatus == null)
			clone.currentstatus = null;
		else
			clone.currentstatus = (ims.pathways.vo.PatientJourneyStatusVo)this.currentstatus.clone();
		if(this.responsibleconsultant == null)
			clone.responsibleconsultant = null;
		else
			clone.responsibleconsultant = (ims.core.vo.HcpLiteVo)this.responsibleconsultant.clone();
		if(this.nextvalidationdate == null)
			clone.nextvalidationdate = null;
		else
			clone.nextvalidationdate = (ims.framework.utils.Date)this.nextvalidationdate.clone();
		if(this.currentclock == null)
			clone.currentclock = null;
		else
			clone.currentclock = (ims.pathways.vo.PathwayClockForRTTCurrentStatusVo)this.currentclock.clone();
		if(this.validationcompleteddt == null)
			clone.validationcompleteddt = null;
		else
			clone.validationcompleteddt = (ims.framework.utils.DateTime)this.validationcompleteddt.clone();
		if(this.validationcompletedby == null)
			clone.validationcompletedby = null;
		else
			clone.validationcompletedby = (ims.core.vo.MemberOfStaffVo)this.validationcompletedby.clone();
		if(this.lastvalidationdate == null)
			clone.lastvalidationdate = null;
		else
			clone.lastvalidationdate = (ims.framework.utils.Date)this.lastvalidationdate.clone();
		if(this.service == null)
			clone.service = null;
		else
			clone.service = (ims.core.vo.ServiceShortVo)this.service.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 (!(PatientPathwaysAwaitingValidationWorklistVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PatientPathwaysAwaitingValidationWorklistVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PatientPathwaysAwaitingValidationWorklistVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PatientPathwaysAwaitingValidationWorklistVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.patient != null)
			count++;
		if(this.pathway != null)
			count++;
		if(this.startdate != null)
			count++;
		if(this.currentstatus != null)
			count++;
		if(this.responsibleconsultant != null)
			count++;
		if(this.nextvalidationdate != null)
			count++;
		if(this.currentclock != null)
			count++;
		if(this.validationcompleteddt != null)
			count++;
		if(this.validationcompletedby != null)
			count++;
		if(this.lastvalidationdate != null)
			count++;
		if(this.service != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 11;
	}
	protected ims.core.vo.PatientForPathwayAwaitingValidationWorklistVo patient;
	protected ims.pathways.vo.PathwayForPatientPathwaysAwaitingValidationWorklistVo pathway;
	protected ims.framework.utils.Date startdate;
	protected ims.pathways.vo.PatientJourneyStatusVo currentstatus;
	protected ims.core.vo.HcpLiteVo responsibleconsultant;
	protected ims.framework.utils.Date nextvalidationdate;
	protected ims.pathways.vo.PathwayClockForRTTCurrentStatusVo currentclock;
	protected ims.framework.utils.DateTime validationcompleteddt;
	protected ims.core.vo.MemberOfStaffVo validationcompletedby;
	protected ims.framework.utils.Date lastvalidationdate;
	protected ims.core.vo.ServiceShortVo service;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
