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

	public HL7MessageInfoVo()
	{
	}
	public HL7MessageInfoVo(ims.admin.vo.beans.HL7MessageInfoVoBean bean)
	{
		this.messagetype = bean.getMessageType();
		this.total = bean.getTotal();
		this.successful = bean.getSuccessful();
		this.failed = bean.getFailed();
		this.lastsuccessdatetime = bean.getLastSuccessDateTime() == null ? null : bean.getLastSuccessDateTime().buildDateTime();
		this.lastfaileddatetime = bean.getLastFailedDateTime() == null ? null : bean.getLastFailedDateTime().buildDateTime();
		this.lastsuccessmessage = bean.getLastSuccessMessage();
		this.lastfailedmessage = bean.getLastFailedMessage();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.admin.vo.beans.HL7MessageInfoVoBean bean)
	{
		this.messagetype = bean.getMessageType();
		this.total = bean.getTotal();
		this.successful = bean.getSuccessful();
		this.failed = bean.getFailed();
		this.lastsuccessdatetime = bean.getLastSuccessDateTime() == null ? null : bean.getLastSuccessDateTime().buildDateTime();
		this.lastfaileddatetime = bean.getLastFailedDateTime() == null ? null : bean.getLastFailedDateTime().buildDateTime();
		this.lastsuccessmessage = bean.getLastSuccessMessage();
		this.lastfailedmessage = bean.getLastFailedMessage();
	}
	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.HL7MessageInfoVoBean bean = null;
		if(map != null)
			bean = (ims.admin.vo.beans.HL7MessageInfoVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.admin.vo.beans.HL7MessageInfoVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getMessageTypeIsNotNull()
	{
		return this.messagetype != null;
	}
	public String getMessageType()
	{
		return this.messagetype;
	}
	public static int getMessageTypeMaxLength()
	{
		return 255;
	}
	public void setMessageType(String value)
	{
		this.isValidated = false;
		this.messagetype = value;
	}
	public boolean getTotalIsNotNull()
	{
		return this.total != null;
	}
	public Integer getTotal()
	{
		return this.total;
	}
	public void setTotal(Integer value)
	{
		this.isValidated = false;
		this.total = value;
	}
	public boolean getSuccessfulIsNotNull()
	{
		return this.successful != null;
	}
	public Integer getSuccessful()
	{
		return this.successful;
	}
	public void setSuccessful(Integer value)
	{
		this.isValidated = false;
		this.successful = value;
	}
	public boolean getFailedIsNotNull()
	{
		return this.failed != null;
	}
	public Integer getFailed()
	{
		return this.failed;
	}
	public void setFailed(Integer value)
	{
		this.isValidated = false;
		this.failed = value;
	}
	public boolean getLastSuccessDateTimeIsNotNull()
	{
		return this.lastsuccessdatetime != null;
	}
	public ims.framework.utils.DateTime getLastSuccessDateTime()
	{
		return this.lastsuccessdatetime;
	}
	public void setLastSuccessDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.lastsuccessdatetime = value;
	}
	public boolean getLastFailedDateTimeIsNotNull()
	{
		return this.lastfaileddatetime != null;
	}
	public ims.framework.utils.DateTime getLastFailedDateTime()
	{
		return this.lastfaileddatetime;
	}
	public void setLastFailedDateTime(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.lastfaileddatetime = value;
	}
	public boolean getLastSuccessMessageIsNotNull()
	{
		return this.lastsuccessmessage != null;
	}
	public String getLastSuccessMessage()
	{
		return this.lastsuccessmessage;
	}
	public static int getLastSuccessMessageMaxLength()
	{
		return 255;
	}
	public void setLastSuccessMessage(String value)
	{
		this.isValidated = false;
		this.lastsuccessmessage = value;
	}
	public boolean getLastFailedMessageIsNotNull()
	{
		return this.lastfailedmessage != null;
	}
	public String getLastFailedMessage()
	{
		return this.lastfailedmessage;
	}
	public static int getLastFailedMessageMaxLength()
	{
		return 255;
	}
	public void setLastFailedMessage(String value)
	{
		this.isValidated = false;
		this.lastfailedmessage = 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 HL7MessageInfoVo))
			return false;
		HL7MessageInfoVo compareObj = (HL7MessageInfoVo)obj;
		if(this.getMessageType() == null && compareObj.getMessageType() != null)
			return false;
		if(this.getMessageType() != null && compareObj.getMessageType() == null)
			return false;
		if(this.getMessageType() != null && compareObj.getMessageType() != null)
			return this.getMessageType().equals(compareObj.getMessageType());
		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;
	
		HL7MessageInfoVo clone = new HL7MessageInfoVo();
		
		clone.messagetype = this.messagetype;
		clone.total = this.total;
		clone.successful = this.successful;
		clone.failed = this.failed;
		if(this.lastsuccessdatetime == null)
			clone.lastsuccessdatetime = null;
		else
			clone.lastsuccessdatetime = (ims.framework.utils.DateTime)this.lastsuccessdatetime.clone();
		if(this.lastfaileddatetime == null)
			clone.lastfaileddatetime = null;
		else
			clone.lastfaileddatetime = (ims.framework.utils.DateTime)this.lastfaileddatetime.clone();
		clone.lastsuccessmessage = this.lastsuccessmessage;
		clone.lastfailedmessage = this.lastfailedmessage;
		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 (!(HL7MessageInfoVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A HL7MessageInfoVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		HL7MessageInfoVo compareObj = (HL7MessageInfoVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getMessageType() == null && compareObj.getMessageType() != null)
				return -1;
			if(this.getMessageType() != null && compareObj.getMessageType() == null)
				return 1;
			if(this.getMessageType() != null && compareObj.getMessageType() != null)
			{
				if(caseInsensitive)
					retVal = this.getMessageType().toLowerCase().compareTo(compareObj.getMessageType().toLowerCase());
				else
					retVal = this.getMessageType().compareTo(compareObj.getMessageType());
			}
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.messagetype != null)
			count++;
		if(this.total != null)
			count++;
		if(this.successful != null)
			count++;
		if(this.failed != null)
			count++;
		if(this.lastsuccessdatetime != null)
			count++;
		if(this.lastfaileddatetime != null)
			count++;
		if(this.lastsuccessmessage != null)
			count++;
		if(this.lastfailedmessage != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 8;
	}
	protected String messagetype;
	protected Integer total;
	protected Integer successful;
	protected Integer failed;
	protected ims.framework.utils.DateTime lastsuccessdatetime;
	protected ims.framework.utils.DateTime lastfaileddatetime;
	protected String lastsuccessmessage;
	protected String lastfailedmessage;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
