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

	public ServiceMonitorVo()
	{
	}
	public ServiceMonitorVo(ims.admin.vo.beans.ServiceMonitorVoBean bean)
	{
		this.servicename = bean.getServiceName();
		this.hits = bean.getHits();
		this.avg = bean.getAvg();
		this.total = bean.getTotal();
		this.stddev = bean.getStdDev();
		this.last = bean.getLast();
		this.min = bean.getMin();
		this.max = bean.getMax();
		this.active = bean.getActive();
		this.avgactive = bean.getAvgActive();
		this.maxactive = bean.getMaxActive();
		this.firstaccess = bean.getFirstAccess() == null ? null : bean.getFirstAccess().buildDateTime();
		this.lastaccess = bean.getLastAccess() == null ? null : bean.getLastAccess().buildDateTime();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.admin.vo.beans.ServiceMonitorVoBean bean)
	{
		this.servicename = bean.getServiceName();
		this.hits = bean.getHits();
		this.avg = bean.getAvg();
		this.total = bean.getTotal();
		this.stddev = bean.getStdDev();
		this.last = bean.getLast();
		this.min = bean.getMin();
		this.max = bean.getMax();
		this.active = bean.getActive();
		this.avgactive = bean.getAvgActive();
		this.maxactive = bean.getMaxActive();
		this.firstaccess = bean.getFirstAccess() == null ? null : bean.getFirstAccess().buildDateTime();
		this.lastaccess = bean.getLastAccess() == null ? null : bean.getLastAccess().buildDateTime();
	}
	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.ServiceMonitorVoBean bean = null;
		if(map != null)
			bean = (ims.admin.vo.beans.ServiceMonitorVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.admin.vo.beans.ServiceMonitorVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public boolean getServiceNameIsNotNull()
	{
		return this.servicename != null;
	}
	public String getServiceName()
	{
		return this.servicename;
	}
	public static int getServiceNameMaxLength()
	{
		return 255;
	}
	public void setServiceName(String value)
	{
		this.isValidated = false;
		this.servicename = value;
	}
	public boolean getHitsIsNotNull()
	{
		return this.hits != null;
	}
	public Integer getHits()
	{
		return this.hits;
	}
	public void setHits(Integer value)
	{
		this.isValidated = false;
		this.hits = value;
	}
	public boolean getAvgIsNotNull()
	{
		return this.avg != null;
	}
	public Integer getAvg()
	{
		return this.avg;
	}
	public void setAvg(Integer value)
	{
		this.isValidated = false;
		this.avg = 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 getStdDevIsNotNull()
	{
		return this.stddev != null;
	}
	public Float getStdDev()
	{
		return this.stddev;
	}
	public void setStdDev(Float value)
	{
		this.isValidated = false;
		this.stddev = value;
	}
	public boolean getLastIsNotNull()
	{
		return this.last != null;
	}
	public Float getLast()
	{
		return this.last;
	}
	public void setLast(Float value)
	{
		this.isValidated = false;
		this.last = value;
	}
	public boolean getMinIsNotNull()
	{
		return this.min != null;
	}
	public Float getMin()
	{
		return this.min;
	}
	public void setMin(Float value)
	{
		this.isValidated = false;
		this.min = value;
	}
	public boolean getMaxIsNotNull()
	{
		return this.max != null;
	}
	public Float getMax()
	{
		return this.max;
	}
	public void setMax(Float value)
	{
		this.isValidated = false;
		this.max = value;
	}
	public boolean getActiveIsNotNull()
	{
		return this.active != null;
	}
	public Integer getActive()
	{
		return this.active;
	}
	public void setActive(Integer value)
	{
		this.isValidated = false;
		this.active = value;
	}
	public boolean getAvgActiveIsNotNull()
	{
		return this.avgactive != null;
	}
	public Float getAvgActive()
	{
		return this.avgactive;
	}
	public void setAvgActive(Float value)
	{
		this.isValidated = false;
		this.avgactive = value;
	}
	public boolean getMaxActiveIsNotNull()
	{
		return this.maxactive != null;
	}
	public Integer getMaxActive()
	{
		return this.maxactive;
	}
	public void setMaxActive(Integer value)
	{
		this.isValidated = false;
		this.maxactive = value;
	}
	public boolean getFirstAccessIsNotNull()
	{
		return this.firstaccess != null;
	}
	public ims.framework.utils.DateTime getFirstAccess()
	{
		return this.firstaccess;
	}
	public void setFirstAccess(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.firstaccess = value;
	}
	public boolean getLastAccessIsNotNull()
	{
		return this.lastaccess != null;
	}
	public ims.framework.utils.DateTime getLastAccess()
	{
		return this.lastaccess;
	}
	public void setLastAccess(ims.framework.utils.DateTime value)
	{
		this.isValidated = false;
		this.lastaccess = value;
	}
	public final String getIItemText()
	{
		return toString();
	}
	public final Integer getBoId() 
	{
		return null;
	}
	public final String getBoClassName()
	{
		return null;
	}
	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		sb.append(",");
		if(this.hits != null)
			sb.append(this.hits);
		return sb.toString();
	}
	public boolean equals(Object obj)
	{
		if(obj == null)
			return false;
		if(!(obj instanceof ServiceMonitorVo))
			return false;
		ServiceMonitorVo compareObj = (ServiceMonitorVo)obj;
		if(this.getServiceName() == null && compareObj.getServiceName() != null)
			return false;
		if(this.getServiceName() != null && compareObj.getServiceName() == null)
			return false;
		if(this.getServiceName() != null && compareObj.getServiceName() != null)
			return this.getServiceName().equals(compareObj.getServiceName());
		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;
	
		ServiceMonitorVo clone = new ServiceMonitorVo();
		
		clone.servicename = this.servicename;
		clone.hits = this.hits;
		clone.avg = this.avg;
		clone.total = this.total;
		clone.stddev = this.stddev;
		clone.last = this.last;
		clone.min = this.min;
		clone.max = this.max;
		clone.active = this.active;
		clone.avgactive = this.avgactive;
		clone.maxactive = this.maxactive;
		if(this.firstaccess == null)
			clone.firstaccess = null;
		else
			clone.firstaccess = (ims.framework.utils.DateTime)this.firstaccess.clone();
		if(this.lastaccess == null)
			clone.lastaccess = null;
		else
			clone.lastaccess = (ims.framework.utils.DateTime)this.lastaccess.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 (!(ServiceMonitorVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A ServiceMonitorVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		ServiceMonitorVo compareObj = (ServiceMonitorVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getServiceName() == null && compareObj.getServiceName() != null)
				return -1;
			if(this.getServiceName() != null && compareObj.getServiceName() == null)
				return 1;
			if(this.getServiceName() != null && compareObj.getServiceName() != null)
			{
				if(caseInsensitive)
					retVal = this.getServiceName().toLowerCase().compareTo(compareObj.getServiceName().toLowerCase());
				else
					retVal = this.getServiceName().compareTo(compareObj.getServiceName());
			}
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = 0;
		if(this.servicename != null)
			count++;
		if(this.hits != null)
			count++;
		if(this.avg != null)
			count++;
		if(this.total != null)
			count++;
		if(this.stddev != null)
			count++;
		if(this.last != null)
			count++;
		if(this.min != null)
			count++;
		if(this.max != null)
			count++;
		if(this.active != null)
			count++;
		if(this.avgactive != null)
			count++;
		if(this.maxactive != null)
			count++;
		if(this.firstaccess != null)
			count++;
		if(this.lastaccess != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return 13;
	}
	protected String servicename;
	protected Integer hits;
	protected Integer avg;
	protected Integer total;
	protected Float stddev;
	protected Float last;
	protected Float min;
	protected Float max;
	protected Integer active;
	protected Float avgactive;
	protected Integer maxactive;
	protected ims.framework.utils.DateTime firstaccess;
	protected ims.framework.utils.DateTime lastaccess;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
