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

/**
 * Linked to clinical.PerfProcAndSignOutIntraOp business object (ID: 1072100150).
 */
public class PerformedProcAndSignOutIntraOpVo extends ims.clinical.vo.PerfProcAndSignOutIntraOpRefVo implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public PerformedProcAndSignOutIntraOpVo()
	{
	}
	public PerformedProcAndSignOutIntraOpVo(Integer id, int version)
	{
		super(id, version);
	}
	public PerformedProcAndSignOutIntraOpVo(ims.clinical.vo.beans.PerformedProcAndSignOutIntraOpVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.theatreappointment = bean.getTheatreAppointment() == null ? null : new ims.scheduling.vo.Booking_AppointmentRefVo(new Integer(bean.getTheatreAppointment().getId()), bean.getTheatreAppointment().getVersion());
		this.unplannedreturntotheatre = bean.getUnplannedreturntotheatre();
		this.confirmedcountscomplete = bean.getConfirmedCountsComplete();
		this.antibioticsafterknifetoskin = bean.getAntibioticsAfterKnifeToSkin() == null ? null : ims.core.vo.lookups.YesNoNotApplicable.buildLookup(bean.getAntibioticsAfterKnifeToSkin());
		this.timeintraopantibioticsgiven = bean.getTimeIntraOpAntibioticsGiven() == null ? null : bean.getTimeIntraOpAntibioticsGiven().buildDateTime();
		this.administrationrecordcompleted = bean.getAdministrationRecordCompleted();
		this.anyspecimenshavebeenlabelled = bean.getAnySpecimensHaveBeenLabelled();
		this.anyequipmentproblemsaddressed = bean.getAnyEquipmentProblemsAddressed() == null ? null : ims.core.vo.lookups.YesNoNotApplicable.buildLookup(bean.getAnyEquipmentProblemsAddressed());
		this.keyconcernsdocumented = bean.getKeyConcernsDocumented();
		this.signaturebyregisteredpractitioner = bean.getSignatureByRegisteredPractitioner() == null ? null : bean.getSignatureByRegisteredPractitioner().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.clinical.vo.beans.PerformedProcAndSignOutIntraOpVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.theatreappointment = bean.getTheatreAppointment() == null ? null : new ims.scheduling.vo.Booking_AppointmentRefVo(new Integer(bean.getTheatreAppointment().getId()), bean.getTheatreAppointment().getVersion());
		this.unplannedreturntotheatre = bean.getUnplannedreturntotheatre();
		this.confirmedcountscomplete = bean.getConfirmedCountsComplete();
		this.antibioticsafterknifetoskin = bean.getAntibioticsAfterKnifeToSkin() == null ? null : ims.core.vo.lookups.YesNoNotApplicable.buildLookup(bean.getAntibioticsAfterKnifeToSkin());
		this.timeintraopantibioticsgiven = bean.getTimeIntraOpAntibioticsGiven() == null ? null : bean.getTimeIntraOpAntibioticsGiven().buildDateTime();
		this.administrationrecordcompleted = bean.getAdministrationRecordCompleted();
		this.anyspecimenshavebeenlabelled = bean.getAnySpecimensHaveBeenLabelled();
		this.anyequipmentproblemsaddressed = bean.getAnyEquipmentProblemsAddressed() == null ? null : ims.core.vo.lookups.YesNoNotApplicable.buildLookup(bean.getAnyEquipmentProblemsAddressed());
		this.keyconcernsdocumented = bean.getKeyConcernsDocumented();
		this.signaturebyregisteredpractitioner = bean.getSignatureByRegisteredPractitioner() == null ? null : bean.getSignatureByRegisteredPractitioner().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.clinical.vo.beans.PerformedProcAndSignOutIntraOpVoBean bean = null;
		if(map != null)
			bean = (ims.clinical.vo.beans.PerformedProcAndSignOutIntraOpVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.clinical.vo.beans.PerformedProcAndSignOutIntraOpVoBean();
			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("THEATREAPPOINTMENT"))
			return getTheatreAppointment();
		if(fieldName.equals("UNPLANNEDRETURNTOTHEATRE"))
			return getUnplannedreturntotheatre();
		if(fieldName.equals("CONFIRMEDCOUNTSCOMPLETE"))
			return getConfirmedCountsComplete();
		if(fieldName.equals("ANTIBIOTICSAFTERKNIFETOSKIN"))
			return getAntibioticsAfterKnifeToSkin();
		if(fieldName.equals("TIMEINTRAOPANTIBIOTICSGIVEN"))
			return getTimeIntraOpAntibioticsGiven();
		if(fieldName.equals("ADMINISTRATIONRECORDCOMPLETED"))
			return getAdministrationRecordCompleted();
		if(fieldName.equals("ANYSPECIMENSHAVEBEENLABELLED"))
			return getAnySpecimensHaveBeenLabelled();
		if(fieldName.equals("ANYEQUIPMENTPROBLEMSADDRESSED"))
			return getAnyEquipmentProblemsAddressed();
		if(fieldName.equals("KEYCONCERNSDOCUMENTED"))
			return getKeyConcernsDocumented();
		if(fieldName.equals("SIGNATUREBYREGISTEREDPRACTITIONER"))
			return getSignatureByRegisteredPractitioner();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getTheatreAppointmentIsNotNull()
	{
		return this.theatreappointment != null;
	}
	public ims.scheduling.vo.Booking_AppointmentRefVo getTheatreAppointment()
	{
		return this.theatreappointment;
	}
	public void setTheatreAppointment(ims.scheduling.vo.Booking_AppointmentRefVo value)
	{
		this.isValidated = false;
		this.theatreappointment = value;
	}
	public boolean getUnplannedreturntotheatreIsNotNull()
	{
		return this.unplannedreturntotheatre != null;
	}
	public Boolean getUnplannedreturntotheatre()
	{
		return this.unplannedreturntotheatre;
	}
	public void setUnplannedreturntotheatre(Boolean value)
	{
		this.isValidated = false;
		this.unplannedreturntotheatre = value;
	}
	public boolean getConfirmedCountsCompleteIsNotNull()
	{
		return this.confirmedcountscomplete != null;
	}
	public Boolean getConfirmedCountsComplete()
	{
		return this.confirmedcountscomplete;
	}
	public void setConfirmedCountsComplete(Boolean value)
	{
		this.isValidated = false;
		this.confirmedcountscomplete = value;
	}
	public boolean getAntibioticsAfterKnifeToSkinIsNotNull()
	{
		return this.antibioticsafterknifetoskin != null;
	}
	public ims.core.vo.lookups.YesNoNotApplicable getAntibioticsAfterKnifeToSkin()
	{
		return this.antibioticsafterknifetoskin;
	}
	public void setAntibioticsAfterKnifeToSkin(ims.core.vo.lookups.YesNoNotApplicable value)
	{
		this.isValidated = false;
		this.antibioticsafterknifetoskin = value;
	}
	public boolean getTimeIntraOpAntibioticsGivenIsNotNull()
	{
		return this.timeintraopantibioticsgiven != null;
	}
	public ims.framework.utils.DateTime getTimeIntraOpAntibioticsGiven()
	{
		return this.timeintraopantibioticsgiven;
	}
	public void setTimeIntraOpAntibioticsGiven(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.timeintraopantibioticsgiven = value;
	}
	public boolean getAdministrationRecordCompletedIsNotNull()
	{
		return this.administrationrecordcompleted != null;
	}
	public Boolean getAdministrationRecordCompleted()
	{
		return this.administrationrecordcompleted;
	}
	public void setAdministrationRecordCompleted(Boolean value)
	{
		this.isValidated = false;
		this.administrationrecordcompleted = value;
	}
	public boolean getAnySpecimensHaveBeenLabelledIsNotNull()
	{
		return this.anyspecimenshavebeenlabelled != null;
	}
	public Boolean getAnySpecimensHaveBeenLabelled()
	{
		return this.anyspecimenshavebeenlabelled;
	}
	public void setAnySpecimensHaveBeenLabelled(Boolean value)
	{
		this.isValidated = false;
		this.anyspecimenshavebeenlabelled = value;
	}
	public boolean getAnyEquipmentProblemsAddressedIsNotNull()
	{
		return this.anyequipmentproblemsaddressed != null;
	}
	public ims.core.vo.lookups.YesNoNotApplicable getAnyEquipmentProblemsAddressed()
	{
		return this.anyequipmentproblemsaddressed;
	}
	public void setAnyEquipmentProblemsAddressed(ims.core.vo.lookups.YesNoNotApplicable value)
	{
		this.isValidated = false;
		this.anyequipmentproblemsaddressed = value;
	}
	public boolean getKeyConcernsDocumentedIsNotNull()
	{
		return this.keyconcernsdocumented != null;
	}
	public Boolean getKeyConcernsDocumented()
	{
		return this.keyconcernsdocumented;
	}
	public void setKeyConcernsDocumented(Boolean value)
	{
		this.isValidated = false;
		this.keyconcernsdocumented = value;
	}
	public boolean getSignatureByRegisteredPractitionerIsNotNull()
	{
		return this.signaturebyregisteredpractitioner != null;
	}
	public ims.core.vo.HcpLiteVo getSignatureByRegisteredPractitioner()
	{
		return this.signaturebyregisteredpractitioner;
	}
	public void setSignatureByRegisteredPractitioner(ims.core.vo.HcpLiteVo value)
	{
		this.isValidated = false;
		this.signaturebyregisteredpractitioner = 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.theatreappointment == null)
			listOfErrors.add("TheatreAppointment is mandatory");
		if(this.anyspecimenshavebeenlabelled == null)
			listOfErrors.add("AnySpecimensHaveBeenLabelled is mandatory");
		if(this.anyequipmentproblemsaddressed == null)
			listOfErrors.add("Have any equipment problems been identified that need to be addressed is mandatory");
		if(this.signaturebyregisteredpractitioner == null)
			listOfErrors.add("Signature By Registered Practitioner 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;
	
		PerformedProcAndSignOutIntraOpVo clone = new PerformedProcAndSignOutIntraOpVo(this.id, this.version);
		
		clone.theatreappointment = this.theatreappointment;
		clone.unplannedreturntotheatre = this.unplannedreturntotheatre;
		clone.confirmedcountscomplete = this.confirmedcountscomplete;
		if(this.antibioticsafterknifetoskin == null)
			clone.antibioticsafterknifetoskin = null;
		else
			clone.antibioticsafterknifetoskin = (ims.core.vo.lookups.YesNoNotApplicable)this.antibioticsafterknifetoskin.clone();
		if(this.timeintraopantibioticsgiven == null)
			clone.timeintraopantibioticsgiven = null;
		else
			clone.timeintraopantibioticsgiven = (ims.framework.utils.DateTime)this.timeintraopantibioticsgiven.clone();
		clone.administrationrecordcompleted = this.administrationrecordcompleted;
		clone.anyspecimenshavebeenlabelled = this.anyspecimenshavebeenlabelled;
		if(this.anyequipmentproblemsaddressed == null)
			clone.anyequipmentproblemsaddressed = null;
		else
			clone.anyequipmentproblemsaddressed = (ims.core.vo.lookups.YesNoNotApplicable)this.anyequipmentproblemsaddressed.clone();
		clone.keyconcernsdocumented = this.keyconcernsdocumented;
		if(this.signaturebyregisteredpractitioner == null)
			clone.signaturebyregisteredpractitioner = null;
		else
			clone.signaturebyregisteredpractitioner = (ims.core.vo.HcpLiteVo)this.signaturebyregisteredpractitioner.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 (!(PerformedProcAndSignOutIntraOpVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A PerformedProcAndSignOutIntraOpVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		if (this.id == null)
			return 1;
		if (((PerformedProcAndSignOutIntraOpVo)obj).getBoId() == null)
			return -1;
		return this.id.compareTo(((PerformedProcAndSignOutIntraOpVo)obj).getBoId());
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.theatreappointment != null)
			count++;
		if(this.unplannedreturntotheatre != null)
			count++;
		if(this.confirmedcountscomplete != null)
			count++;
		if(this.antibioticsafterknifetoskin != null)
			count++;
		if(this.timeintraopantibioticsgiven != null)
			count++;
		if(this.administrationrecordcompleted != null)
			count++;
		if(this.anyspecimenshavebeenlabelled != null)
			count++;
		if(this.anyequipmentproblemsaddressed != null)
			count++;
		if(this.keyconcernsdocumented != null)
			count++;
		if(this.signaturebyregisteredpractitioner != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 10;
	}
	protected ims.scheduling.vo.Booking_AppointmentRefVo theatreappointment;
	protected Boolean unplannedreturntotheatre;
	protected Boolean confirmedcountscomplete;
	protected ims.core.vo.lookups.YesNoNotApplicable antibioticsafterknifetoskin;
	protected ims.framework.utils.DateTime timeintraopantibioticsgiven;
	protected Boolean administrationrecordcompleted;
	protected Boolean anyspecimenshavebeenlabelled;
	protected ims.core.vo.lookups.YesNoNotApplicable anyequipmentproblemsaddressed;
	protected Boolean keyconcernsdocumented;
	protected ims.core.vo.HcpLiteVo signaturebyregisteredpractitioner;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
