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


public class DoctorsWorkListItemVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public DoctorsWorkListItemVo()
	{
	}
	public DoctorsWorkListItemVo(ims.ccosched.vo.beans.DoctorsWorkListItemVoBean bean)
	{
		this.id = bean.getID();
		this.hospnum = bean.getHospNum();
		this.name = bean.getName();
		this.type = bean.getType();
		this.typeid = bean.getTypeID();
		this.activity = bean.getActivity();
		this.hcp = bean.getHCP();
		this.clinic = bean.getClinic();
		this.appointmenttime = bean.getAppointmentTime();
		this.treatmentaction = bean.getTreatmentAction();
		this.deadline = bean.getDeadline() == null ? null : bean.getDeadline().buildDate();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.ccosched.vo.beans.DoctorsWorkListItemVoBean bean)
	{
		this.id = bean.getID();
		this.hospnum = bean.getHospNum();
		this.name = bean.getName();
		this.type = bean.getType();
		this.typeid = bean.getTypeID();
		this.activity = bean.getActivity();
		this.hcp = bean.getHCP();
		this.clinic = bean.getClinic();
		this.appointmenttime = bean.getAppointmentTime();
		this.treatmentaction = bean.getTreatmentAction();
		this.deadline = bean.getDeadline() == null ? null : bean.getDeadline().buildDate();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.ccosched.vo.beans.DoctorsWorkListItemVoBean bean = null;
		if(map != null)
			bean = (ims.ccosched.vo.beans.DoctorsWorkListItemVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.ccosched.vo.beans.DoctorsWorkListItemVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getIDIsNotNull()
	{
		return this.id != null;
	}
	public String getID()
	{
		return this.id;
	}
	public static int getIDMaxLength()
	{
		return 255;
	}
	public void setID(String value)
	{
		this.isValidated = false;
		this.id = value;
	}
	public boolean getHospNumIsNotNull()
	{
		return this.hospnum != null;
	}
	public String getHospNum()
	{
		return this.hospnum;
	}
	public static int getHospNumMaxLength()
	{
		return 255;
	}
	public void setHospNum(String value)
	{
		this.isValidated = false;
		this.hospnum = value;
	}
	public boolean getNameIsNotNull()
	{
		return this.name != null;
	}
	public String getName()
	{
		return this.name;
	}
	public static int getNameMaxLength()
	{
		return 255;
	}
	public void setName(String value)
	{
		this.isValidated = false;
		this.name = value;
	}
	public boolean getTypeIsNotNull()
	{
		return this.type != null;
	}
	public String getType()
	{
		return this.type;
	}
	public static int getTypeMaxLength()
	{
		return 255;
	}
	public void setType(String value)
	{
		this.isValidated = false;
		this.type = value;
	}
	public boolean getTypeIDIsNotNull()
	{
		return this.typeid != null;
	}
	public Integer getTypeID()
	{
		return this.typeid;
	}
	public void setTypeID(Integer value)
	{
		this.isValidated = false;
		this.typeid = value;
	}
	public boolean getActivityIsNotNull()
	{
		return this.activity != null;
	}
	public String getActivity()
	{
		return this.activity;
	}
	public static int getActivityMaxLength()
	{
		return 255;
	}
	public void setActivity(String value)
	{
		this.isValidated = false;
		this.activity = value;
	}
	public boolean getHCPIsNotNull()
	{
		return this.hcp != null;
	}
	public String getHCP()
	{
		return this.hcp;
	}
	public static int getHCPMaxLength()
	{
		return 255;
	}
	public void setHCP(String value)
	{
		this.isValidated = false;
		this.hcp = value;
	}
	public boolean getClinicIsNotNull()
	{
		return this.clinic != null;
	}
	public String getClinic()
	{
		return this.clinic;
	}
	public static int getClinicMaxLength()
	{
		return 255;
	}
	public void setClinic(String value)
	{
		this.isValidated = false;
		this.clinic = value;
	}
	public boolean getAppointmentTimeIsNotNull()
	{
		return this.appointmenttime != null;
	}
	public String getAppointmentTime()
	{
		return this.appointmenttime;
	}
	public static int getAppointmentTimeMaxLength()
	{
		return 255;
	}
	public void setAppointmentTime(String value)
	{
		this.isValidated = false;
		this.appointmenttime = value;
	}
	public boolean getTreatmentActionIsNotNull()
	{
		return this.treatmentaction != null;
	}
	public String getTreatmentAction()
	{
		return this.treatmentaction;
	}
	public static int getTreatmentActionMaxLength()
	{
		return 255;
	}
	public void setTreatmentAction(String value)
	{
		this.isValidated = false;
		this.treatmentaction = value;
	}
	public boolean getDeadlineIsNotNull()
	{
		return this.deadline != null;
	}
	public ims.framework.utils.Date getDeadline()
	{
		return this.deadline;
	}
	public void setDeadline(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.deadline = value;
	}
	public final String getIItemText()
	{
		return toString();
	}
	public final Integer getBoId() 
	{
		return null;
	}
	public final String getBoClassName()
	{
		return null;
	}
	public boolean equals(Object obj)
	{
		if(obj == null)
			return false;
		if(!(obj instanceof DoctorsWorkListItemVo))
			return false;
		DoctorsWorkListItemVo compareObj = (DoctorsWorkListItemVo)obj;
		if(this.getHospNum() == null && compareObj.getHospNum() != null)
			return false;
		if(this.getHospNum() != null && compareObj.getHospNum() == null)
			return false;
		if(this.getHospNum() != null && compareObj.getHospNum() != null)
			if(!this.getHospNum().equals(compareObj.getHospNum()))
				return false;
		if(this.getName() == null && compareObj.getName() != null)
			return false;
		if(this.getName() != null && compareObj.getName() == null)
			return false;
		if(this.getName() != null && compareObj.getName() != null)
			if(!this.getName().equals(compareObj.getName()))
				return false;
		if(this.getActivity() == null && compareObj.getActivity() != null)
			return false;
		if(this.getActivity() != null && compareObj.getActivity() == null)
			return false;
		if(this.getActivity() != null && compareObj.getActivity() != null)
			if(!this.getActivity().equals(compareObj.getActivity()))
				return false;
		if(this.getHCP() == null && compareObj.getHCP() != null)
			return false;
		if(this.getHCP() != null && compareObj.getHCP() == null)
			return false;
		if(this.getHCP() != null && compareObj.getHCP() != null)
			if(!this.getHCP().equals(compareObj.getHCP()))
				return false;
		if(this.getClinic() == null && compareObj.getClinic() != null)
			return false;
		if(this.getClinic() != null && compareObj.getClinic() == null)
			return false;
		if(this.getClinic() != null && compareObj.getClinic() != null)
			if(!this.getClinic().equals(compareObj.getClinic()))
				return false;
		if(this.getTreatmentAction() == null && compareObj.getTreatmentAction() != null)
			return false;
		if(this.getTreatmentAction() != null && compareObj.getTreatmentAction() == null)
			return false;
		if(this.getTreatmentAction() != null && compareObj.getTreatmentAction() != null)
			if(!this.getTreatmentAction().equals(compareObj.getTreatmentAction()))
				return false;
		if(this.getDeadline() == null && compareObj.getDeadline() != null)
			return false;
		if(this.getDeadline() != null && compareObj.getDeadline() == null)
			return false;
		if(this.getDeadline() != null && compareObj.getDeadline() != null)
			return this.getDeadline().equals(compareObj.getDeadline());
		return super.equals(obj);
	}
	/**
	* AppointmentRecord methods
	*/
	public void setAppointmentRecord(Object obj)
	{
		this.record = obj;
	}
	
	public Object getAppointmentRecord()
	{
		return this.record;
	}
	protected Object record;
	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]);
			}
		}
		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 Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		DoctorsWorkListItemVo clone = new DoctorsWorkListItemVo();
		
		clone.id = this.id;
		clone.hospnum = this.hospnum;
		clone.name = this.name;
		clone.type = this.type;
		clone.typeid = this.typeid;
		clone.activity = this.activity;
		clone.hcp = this.hcp;
		clone.clinic = this.clinic;
		clone.appointmenttime = this.appointmenttime;
		clone.treatmentaction = this.treatmentaction;
		if(this.deadline == null)
			clone.deadline = null;
		else
			clone.deadline = (ims.framework.utils.Date)this.deadline.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 (!(DoctorsWorkListItemVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A DoctorsWorkListItemVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		DoctorsWorkListItemVo compareObj = (DoctorsWorkListItemVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getDeadline() == null && compareObj.getDeadline() != null)
				return -1;
			if(this.getDeadline() != null && compareObj.getDeadline() == null)
				return 1;
			if(this.getDeadline() != null && compareObj.getDeadline() != null)
				retVal = this.getDeadline().compareTo(compareObj.getDeadline());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.id != null)
			count++;
		if(this.hospnum != null)
			count++;
		if(this.name != null)
			count++;
		if(this.type != null)
			count++;
		if(this.typeid != null)
			count++;
		if(this.activity != null)
			count++;
		if(this.hcp != null)
			count++;
		if(this.clinic != null)
			count++;
		if(this.appointmenttime != null)
			count++;
		if(this.treatmentaction != null)
			count++;
		if(this.deadline != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 11;
	}
	protected String id;
	protected String hospnum;
	protected String name;
	protected String type;
	protected Integer typeid;
	protected String activity;
	protected String hcp;
	protected String clinic;
	protected String appointmenttime;
	protected String treatmentaction;
	protected ims.framework.utils.Date deadline;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
