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


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

	public ClearSpanAuditVo()
	{
	}
	public ClearSpanAuditVo(ims.admin.vo.beans.ClearSpanAuditVoBean bean)
	{
		this.timegenerated = bean.getTimeGenerated() == null ? null : bean.getTimeGenerated().buildDateTime();
		this.eventtype = bean.getEventType() == null ? null : ims.admin.vo.lookups.ClearSpanEvents.buildLookup(bean.getEventType());
		this.evenlevel = bean.getEvenLevel() == null ? null : ims.admin.vo.lookups.ClearSpanEventLevel.buildLookup(bean.getEvenLevel());
		this.sourcename = bean.getSourceName();
		this.message = bean.getMessage();
		this.data = bean.getData();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.admin.vo.beans.ClearSpanAuditVoBean bean)
	{
		this.timegenerated = bean.getTimeGenerated() == null ? null : bean.getTimeGenerated().buildDateTime();
		this.eventtype = bean.getEventType() == null ? null : ims.admin.vo.lookups.ClearSpanEvents.buildLookup(bean.getEventType());
		this.evenlevel = bean.getEvenLevel() == null ? null : ims.admin.vo.lookups.ClearSpanEventLevel.buildLookup(bean.getEvenLevel());
		this.sourcename = bean.getSourceName();
		this.message = bean.getMessage();
		this.data = bean.getData();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.admin.vo.beans.ClearSpanAuditVoBean bean = null;
		if(map != null)
			bean = (ims.admin.vo.beans.ClearSpanAuditVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.admin.vo.beans.ClearSpanAuditVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getTimeGeneratedIsNotNull()
	{
		return this.timegenerated != null;
	}
	public ims.framework.utils.DateTime getTimeGenerated()
	{
		return this.timegenerated;
	}
	public void setTimeGenerated(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.timegenerated = value;
	}
	public boolean getEventTypeIsNotNull()
	{
		return this.eventtype != null;
	}
	public ims.admin.vo.lookups.ClearSpanEvents getEventType()
	{
		return this.eventtype;
	}
	public void setEventType(ims.admin.vo.lookups.ClearSpanEvents value)
	{
		this.isValidated = false;
		this.eventtype = value;
	}
	public boolean getEvenLevelIsNotNull()
	{
		return this.evenlevel != null;
	}
	public ims.admin.vo.lookups.ClearSpanEventLevel getEvenLevel()
	{
		return this.evenlevel;
	}
	public void setEvenLevel(ims.admin.vo.lookups.ClearSpanEventLevel value)
	{
		this.isValidated = false;
		this.evenlevel = value;
	}
	public boolean getSourceNameIsNotNull()
	{
		return this.sourcename != null;
	}
	public String getSourceName()
	{
		return this.sourcename;
	}
	public static int getSourceNameMaxLength()
	{
		return 255;
	}
	public void setSourceName(String value)
	{
		this.isValidated = false;
		this.sourcename = value;
	}
	public boolean getMessageIsNotNull()
	{
		return this.message != null;
	}
	public String getMessage()
	{
		return this.message;
	}
	public static int getMessageMaxLength()
	{
		return 255;
	}
	public void setMessage(String value)
	{
		this.isValidated = false;
		this.message = value;
	}
	public boolean getDataIsNotNull()
	{
		return this.data != null;
	}
	public String getData()
	{
		return this.data;
	}
	public static int getDataMaxLength()
	{
		return 255;
	}
	public void setData(String value)
	{
		this.isValidated = false;
		this.data = 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 ClearSpanAuditVo))
			return false;
		ClearSpanAuditVo compareObj = (ClearSpanAuditVo)obj;
		if(this.getTimeGenerated() == null && compareObj.getTimeGenerated() != null)
			return false;
		if(this.getTimeGenerated() != null && compareObj.getTimeGenerated() == null)
			return false;
		if(this.getTimeGenerated() != null && compareObj.getTimeGenerated() != null)
			if(!this.getTimeGenerated().equals(compareObj.getTimeGenerated()))
				return false;
		if(this.getEventType() == null && compareObj.getEventType() != null)
			return false;
		if(this.getEventType() != null && compareObj.getEventType() == null)
			return false;
		if(this.getEventType() != null && compareObj.getEventType() != null)
			if(!this.getEventType().equals(compareObj.getEventType()))
				return false;
		if(this.getEvenLevel() == null && compareObj.getEvenLevel() != null)
			return false;
		if(this.getEvenLevel() != null && compareObj.getEvenLevel() == null)
			return false;
		if(this.getEvenLevel() != null && compareObj.getEvenLevel() != null)
			if(!this.getEvenLevel().equals(compareObj.getEvenLevel()))
				return false;
		if(this.getSourceName() == null && compareObj.getSourceName() != null)
			return false;
		if(this.getSourceName() != null && compareObj.getSourceName() == null)
			return false;
		if(this.getSourceName() != null && compareObj.getSourceName() != null)
			if(!this.getSourceName().equals(compareObj.getSourceName()))
				return false;
		if(this.getMessage() == null && compareObj.getMessage() != null)
			return false;
		if(this.getMessage() != null && compareObj.getMessage() == null)
			return false;
		if(this.getMessage() != null && compareObj.getMessage() != null)
			if(!this.getMessage().equals(compareObj.getMessage()))
				return false;
		if(this.getData() == null && compareObj.getData() != null)
			return false;
		if(this.getData() != null && compareObj.getData() == null)
			return false;
		if(this.getData() != null && compareObj.getData() != null)
			return this.getData().equals(compareObj.getData());
		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;
	
		ClearSpanAuditVo clone = new ClearSpanAuditVo();
		
		if(this.timegenerated == null)
			clone.timegenerated = null;
		else
			clone.timegenerated = (ims.framework.utils.DateTime)this.timegenerated.clone();
		if(this.eventtype == null)
			clone.eventtype = null;
		else
			clone.eventtype = (ims.admin.vo.lookups.ClearSpanEvents)this.eventtype.clone();
		if(this.evenlevel == null)
			clone.evenlevel = null;
		else
			clone.evenlevel = (ims.admin.vo.lookups.ClearSpanEventLevel)this.evenlevel.clone();
		clone.sourcename = this.sourcename;
		clone.message = this.message;
		clone.data = this.data;
		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 (!(ClearSpanAuditVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ClearSpanAuditVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ClearSpanAuditVo compareObj = (ClearSpanAuditVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getTimeGenerated() == null && compareObj.getTimeGenerated() != null)
				return -1;
			if(this.getTimeGenerated() != null && compareObj.getTimeGenerated() == null)
				return 1;
			if(this.getTimeGenerated() != null && compareObj.getTimeGenerated() != null)
				retVal = this.getTimeGenerated().compareTo(compareObj.getTimeGenerated());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.timegenerated != null)
			count++;
		if(this.eventtype != null)
			count++;
		if(this.evenlevel != null)
			count++;
		if(this.sourcename != null)
			count++;
		if(this.message != null)
			count++;
		if(this.data != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 6;
	}
	protected ims.framework.utils.DateTime timegenerated;
	protected ims.admin.vo.lookups.ClearSpanEvents eventtype;
	protected ims.admin.vo.lookups.ClearSpanEventLevel evenlevel;
	protected String sourcename;
	protected String message;
	protected String data;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
