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


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

	public filterVo()
	{
	}
	public filterVo(ims.naes.vo.beans.filterVoBean bean)
	{
		this.action = bean.getAction() == null ? null : ims.naes.vo.lookups.Action.buildLookup(bean.getAction());
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.status = bean.getStatus() == null ? null : ims.naes.vo.lookups.NaesActionStatus.buildLookup(bean.getStatus());
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
		this.days = bean.getDays();
		this.positiveornegative = bean.getPositiveOrNegative();
		this.ordernumber = bean.getOrderNumber();
		this.moslite = bean.getMOSLite() == null ? null : bean.getMOSLite().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.naes.vo.beans.filterVoBean bean)
	{
		this.action = bean.getAction() == null ? null : ims.naes.vo.lookups.Action.buildLookup(bean.getAction());
		this.startdate = bean.getStartDate() == null ? null : bean.getStartDate().buildDate();
		this.status = bean.getStatus() == null ? null : ims.naes.vo.lookups.NaesActionStatus.buildLookup(bean.getStatus());
		this.todate = bean.getToDate() == null ? null : bean.getToDate().buildDate();
		this.days = bean.getDays();
		this.positiveornegative = bean.getPositiveOrNegative();
		this.ordernumber = bean.getOrderNumber();
		this.moslite = bean.getMOSLite() == null ? null : bean.getMOSLite().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.naes.vo.beans.filterVoBean bean = null;
		if(map != null)
			bean = (ims.naes.vo.beans.filterVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.naes.vo.beans.filterVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getActionIsNotNull()
	{
		return this.action != null;
	}
	public ims.naes.vo.lookups.Action getAction()
	{
		return this.action;
	}
	public void setAction(ims.naes.vo.lookups.Action value)
	{
		this.isValidated = false;
		this.action = 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 getStatusIsNotNull()
	{
		return this.status != null;
	}
	public ims.naes.vo.lookups.NaesActionStatus getStatus()
	{
		return this.status;
	}
	public void setStatus(ims.naes.vo.lookups.NaesActionStatus value)
	{
		this.isValidated = false;
		this.status = value;
	}
	public boolean getToDateIsNotNull()
	{
		return this.todate != null;
	}
	public ims.framework.utils.Date getToDate()
	{
		return this.todate;
	}
	public void setToDate(ims.framework.utils.Date value)
	{
		this.isValidated = false;
		this.todate = value;
	}
	public boolean getDaysIsNotNull()
	{
		return this.days != null;
	}
	public Integer getDays()
	{
		return this.days;
	}
	public void setDays(Integer value)
	{
		this.isValidated = false;
		this.days = value;
	}
	public boolean getPositiveOrNegativeIsNotNull()
	{
		return this.positiveornegative != null;
	}
	public Boolean getPositiveOrNegative()
	{
		return this.positiveornegative;
	}
	public void setPositiveOrNegative(Boolean value)
	{
		this.isValidated = false;
		this.positiveornegative = value;
	}
	public boolean getOrderNumberIsNotNull()
	{
		return this.ordernumber != null;
	}
	public String getOrderNumber()
	{
		return this.ordernumber;
	}
	public static int getOrderNumberMaxLength()
	{
		return 255;
	}
	public void setOrderNumber(String value)
	{
		this.isValidated = false;
		this.ordernumber = value;
	}
	public boolean getMOSLiteIsNotNull()
	{
		return this.moslite != null;
	}
	public ims.core.vo.MemberOfStaffLiteVo getMOSLite()
	{
		return this.moslite;
	}
	public void setMOSLite(ims.core.vo.MemberOfStaffLiteVo value)
	{
		this.isValidated = false;
		this.moslite = 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 filterVo))
			return false;
		filterVo compareObj = (filterVo)obj;
		if(this.getAction() == null && compareObj.getAction() != null)
			return false;
		if(this.getAction() != null && compareObj.getAction() == null)
			return false;
		if(this.getAction() != null && compareObj.getAction() != null)
			return this.getAction().equals(compareObj.getAction());
		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;
	
		filterVo clone = new filterVo();
		
		if(this.action == null)
			clone.action = null;
		else
			clone.action = (ims.naes.vo.lookups.Action)this.action.clone();
		if(this.startdate == null)
			clone.startdate = null;
		else
			clone.startdate = (ims.framework.utils.Date)this.startdate.clone();
		if(this.status == null)
			clone.status = null;
		else
			clone.status = (ims.naes.vo.lookups.NaesActionStatus)this.status.clone();
		if(this.todate == null)
			clone.todate = null;
		else
			clone.todate = (ims.framework.utils.Date)this.todate.clone();
		clone.days = this.days;
		clone.positiveornegative = this.positiveornegative;
		clone.ordernumber = this.ordernumber;
		if(this.moslite == null)
			clone.moslite = null;
		else
			clone.moslite = (ims.core.vo.MemberOfStaffLiteVo)this.moslite.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 (!(filterVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A filterVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		filterVo compareObj = (filterVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getAction() == null && compareObj.getAction() != null)
				return -1;
			if(this.getAction() != null && compareObj.getAction() == null)
				return 1;
			if(this.getAction() != null && compareObj.getAction() != null)
				retVal = this.getAction().compareTo(compareObj.getAction());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.action != null)
			count++;
		if(this.startdate != null)
			count++;
		if(this.status != null)
			count++;
		if(this.todate != null)
			count++;
		if(this.days != null)
			count++;
		if(this.positiveornegative != null)
			count++;
		if(this.ordernumber != null)
			count++;
		if(this.moslite != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected ims.naes.vo.lookups.Action action;
	protected ims.framework.utils.Date startdate;
	protected ims.naes.vo.lookups.NaesActionStatus status;
	protected ims.framework.utils.Date todate;
	protected Integer days;
	protected Boolean positiveornegative;
	protected String ordernumber;
	protected ims.core.vo.MemberOfStaffLiteVo moslite;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
