/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/ccosched/vo/ActivityViewPatientVo.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 ActivityViewPatientVo extends ims.vo.ValueObject implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public ActivityViewPatientVo()
	{
	}
	public ActivityViewPatientVo(ims.ccosched.vo.beans.ActivityViewPatientVoBean bean)
	{
		this.hospnum = bean.getHospNum();
		this.name = bean.getName();
		this.wait = bean.getWait();
		this.priority = bean.getPriority();
		this.actionstatus = bean.getActionStatus();
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.enddate = bean.getEndDate() == null ? null : bean.getEndDate().buildDate();
		this.consultant = bean.getConsultant();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.ccosched.vo.beans.ActivityViewPatientVoBean bean)
	{
		this.hospnum = bean.getHospNum();
		this.name = bean.getName();
		this.wait = bean.getWait();
		this.priority = bean.getPriority();
		this.actionstatus = bean.getActionStatus();
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.enddate = bean.getEndDate() == null ? null : bean.getEndDate().buildDate();
		this.consultant = bean.getConsultant();
	}
	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.ActivityViewPatientVoBean bean = null;
		if(map != null)
			bean = (ims.ccosched.vo.beans.ActivityViewPatientVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.ccosched.vo.beans.ActivityViewPatientVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	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 getWaitIsNotNull()
	{
		return this.wait != null;
	}
	public Integer getWait()
	{
		return this.wait;
	}
	public void setWait(Integer value)
	{
		this.isValidated = false;
		this.wait = value;
	}
	public boolean getPriorityIsNotNull()
	{
		return this.priority != null;
	}
	public String getPriority()
	{
		return this.priority;
	}
	public static int getPriorityMaxLength()
	{
		return 255;
	}
	public void setPriority(String value)
	{
		this.isValidated = false;
		this.priority = value;
	}
	public boolean getActionStatusIsNotNull()
	{
		return this.actionstatus != null;
	}
	public String getActionStatus()
	{
		return this.actionstatus;
	}
	public static int getActionStatusMaxLength()
	{
		return 255;
	}
	public void setActionStatus(String value)
	{
		this.isValidated = false;
		this.actionstatus = 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 getEndDateIsNotNull()
	{
		return this.enddate != null;
	}
	public ims.framework.utils.Date getEndDate()
	{
		return this.enddate;
	}
	public void setEndDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.enddate = value;
	}
	public boolean getConsultantIsNotNull()
	{
		return this.consultant != null;
	}
	public String getConsultant()
	{
		return this.consultant;
	}
	public static int getConsultantMaxLength()
	{
		return 255;
	}
	public void setConsultant(String value)
	{
		this.isValidated = false;
		this.consultant = 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 ActivityViewPatientVo))
			return false;
		ActivityViewPatientVo compareObj = (ActivityViewPatientVo)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.getWait() == null && compareObj.getWait() != null)
			return false;
		if(this.getWait() != null && compareObj.getWait() == null)
			return false;
		if(this.getWait() != null && compareObj.getWait() != null)
			if(!this.getWait().equals(compareObj.getWait()))
				return false;
		if(this.getPriority() == null && compareObj.getPriority() != null)
			return false;
		if(this.getPriority() != null && compareObj.getPriority() == null)
			return false;
		if(this.getPriority() != null && compareObj.getPriority() != null)
			return this.getPriority().equals(compareObj.getPriority());
		return super.equals(obj);
	}
	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;
	
		ActivityViewPatientVo clone = new ActivityViewPatientVo();
		
		clone.hospnum = this.hospnum;
		clone.name = this.name;
		clone.wait = this.wait;
		clone.priority = this.priority;
		clone.actionstatus = this.actionstatus;
		if(this.startdate == null)
			clone.startdate = null;
		else
			clone.startdate = (ims.framework.utils.Date)this.startdate.clone();
		if(this.enddate == null)
			clone.enddate = null;
		else
			clone.enddate = (ims.framework.utils.Date)this.enddate.clone();
		clone.consultant = this.consultant;
		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 (!(ActivityViewPatientVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ActivityViewPatientVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ActivityViewPatientVo compareObj = (ActivityViewPatientVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getStartDate() == null && compareObj.getStartDate() != null)
				return -1;
			if(this.getStartDate() != null && compareObj.getStartDate() == null)
				return 1;
			if(this.getStartDate() != null && compareObj.getStartDate() != null)
				retVal = this.getStartDate().compareTo(compareObj.getStartDate());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.hospnum != null)
			count++;
		if(this.name != null)
			count++;
		if(this.wait != null)
			count++;
		if(this.priority != null)
			count++;
		if(this.actionstatus != null)
			count++;
		if(this.startdate != null)
			count++;
		if(this.enddate != null)
			count++;
		if(this.consultant != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected String hospnum;
	protected String name;
	protected Integer wait;
	protected String priority;
	protected String actionstatus;
	protected ims.framework.utils.Date startdate;
	protected ims.framework.utils.Date enddate;
	protected String consultant;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
