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


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

	public CDSResultVo()
	{
	}
	public CDSResultVo(ims.core.vo.beans.CDSResultVoBean bean)
	{
		this.successful = bean.getSuccessful();
		this.errormessage = bean.getErrorMessage();
		this.resulturl = bean.getResultUrl();
		this.logurl = bean.getLogUrl();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.core.vo.beans.CDSResultVoBean bean)
	{
		this.successful = bean.getSuccessful();
		this.errormessage = bean.getErrorMessage();
		this.resulturl = bean.getResultUrl();
		this.logurl = bean.getLogUrl();
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.core.vo.beans.CDSResultVoBean bean = null;
		if(map != null)
			bean = (ims.core.vo.beans.CDSResultVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.core.vo.beans.CDSResultVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getSuccessfulIsNotNull()
	{
		return this.successful != null;
	}
	public Boolean getSuccessful()
	{
		return this.successful;
	}
	public void setSuccessful(Boolean value)
	{
		this.isValidated = false;
		this.successful = value;
	}
	public boolean getErrorMessageIsNotNull()
	{
		return this.errormessage != null;
	}
	public String getErrorMessage()
	{
		return this.errormessage;
	}
	public static int getErrorMessageMaxLength()
	{
		return 255;
	}
	public void setErrorMessage(String value)
	{
		this.isValidated = false;
		this.errormessage = value;
	}
	public boolean getResultUrlIsNotNull()
	{
		return this.resulturl != null;
	}
	public String getResultUrl()
	{
		return this.resulturl;
	}
	public static int getResultUrlMaxLength()
	{
		return 255;
	}
	public void setResultUrl(String value)
	{
		this.isValidated = false;
		this.resulturl = value;
	}
	public boolean getLogUrlIsNotNull()
	{
		return this.logurl != null;
	}
	public String getLogUrl()
	{
		return this.logurl;
	}
	public static int getLogUrlMaxLength()
	{
		return 255;
	}
	public void setLogUrl(String value)
	{
		this.isValidated = false;
		this.logurl = 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 CDSResultVo))
			return false;
		CDSResultVo compareObj = (CDSResultVo)obj;
		if(this.getSuccessful() == null && compareObj.getSuccessful() != null)
			return false;
		if(this.getSuccessful() != null && compareObj.getSuccessful() == null)
			return false;
		if(this.getSuccessful() != null && compareObj.getSuccessful() != null)
			if(!this.getSuccessful().equals(compareObj.getSuccessful()))
				return false;
		if(this.getErrorMessage() == null && compareObj.getErrorMessage() != null)
			return false;
		if(this.getErrorMessage() != null && compareObj.getErrorMessage() == null)
			return false;
		if(this.getErrorMessage() != null && compareObj.getErrorMessage() != null)
			if(!this.getErrorMessage().equals(compareObj.getErrorMessage()))
				return false;
		if(this.getResultUrl() == null && compareObj.getResultUrl() != null)
			return false;
		if(this.getResultUrl() != null && compareObj.getResultUrl() == null)
			return false;
		if(this.getResultUrl() != null && compareObj.getResultUrl() != null)
			if(!this.getResultUrl().equals(compareObj.getResultUrl()))
				return false;
		if(this.getLogUrl() == null && compareObj.getLogUrl() != null)
			return false;
		if(this.getLogUrl() != null && compareObj.getLogUrl() == null)
			return false;
		if(this.getLogUrl() != null && compareObj.getLogUrl() != null)
			return this.getLogUrl().equals(compareObj.getLogUrl());
		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;
	
		CDSResultVo clone = new CDSResultVo();
		
		clone.successful = this.successful;
		clone.errormessage = this.errormessage;
		clone.resulturl = this.resulturl;
		clone.logurl = this.logurl;
		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 (!(CDSResultVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A CDSResultVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		CDSResultVo compareObj = (CDSResultVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getSuccessful() == null && compareObj.getSuccessful() != null)
				return -1;
			if(this.getSuccessful() != null && compareObj.getSuccessful() == null)
				return 1;
			if(this.getSuccessful() != null && compareObj.getSuccessful() != null)
				retVal = this.getSuccessful().compareTo(compareObj.getSuccessful());
		}
		if (retVal == 0)
		{
			if(this.getErrorMessage() == null && compareObj.getErrorMessage() != null)
				return -1;
			if(this.getErrorMessage() != null && compareObj.getErrorMessage() == null)
				return 1;
			if(this.getErrorMessage() != null && compareObj.getErrorMessage() != null)
			{
				if(caseInsensitive)
					retVal = this.getErrorMessage().toLowerCase().compareTo(compareObj.getErrorMessage().toLowerCase());
				else
					retVal = this.getErrorMessage().compareTo(compareObj.getErrorMessage());
			}
		}
		if (retVal == 0)
		{
			if(this.getResultUrl() == null && compareObj.getResultUrl() != null)
				return -1;
			if(this.getResultUrl() != null && compareObj.getResultUrl() == null)
				return 1;
			if(this.getResultUrl() != null && compareObj.getResultUrl() != null)
			{
				if(caseInsensitive)
					retVal = this.getResultUrl().toLowerCase().compareTo(compareObj.getResultUrl().toLowerCase());
				else
					retVal = this.getResultUrl().compareTo(compareObj.getResultUrl());
			}
		}
		if (retVal == 0)
		{
			if(this.getLogUrl() == null && compareObj.getLogUrl() != null)
				return -1;
			if(this.getLogUrl() != null && compareObj.getLogUrl() == null)
				return 1;
			if(this.getLogUrl() != null && compareObj.getLogUrl() != null)
			{
				if(caseInsensitive)
					retVal = this.getLogUrl().toLowerCase().compareTo(compareObj.getLogUrl().toLowerCase());
				else
					retVal = this.getLogUrl().compareTo(compareObj.getLogUrl());
			}
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.successful != null)
			count++;
		if(this.errormessage != null)
			count++;
		if(this.resulturl != null)
			count++;
		if(this.logurl != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 4;
	}
	protected Boolean successful;
	protected String errormessage;
	protected String resulturl;
	protected String logurl;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
