/*
 * Created on Dec 7, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.facility.beans;

import java.io.Serializable;
import java.util.Date;

/**
 * @author DNS   CHENB
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class MessageLogBean implements Comparable, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 57654146051125635L;
	private String logId = null;
	private String logDate = null;
	private String type = null;
	private String ackType = null;
	private String error = null;
	private String raw = null;
	private String facilityName = null;
	private Date createDate = null;
	
	
	/**
	 * @return Returns the logId.
	 */
	public String getLogId() {
		return logId;
	}
	/**
	 * @param logId The logId to set.
	 */
	public void setLogId(String logId) {
		this.logId = logId;
	}
	/**
	 * @return Returns the ackType.
	 */
	public String getAckType() {
		return ackType;
	}
	/**
	 * @param ackType The ackType to set.
	 */
	public void setAckType(String ackType) {
		this.ackType = ackType;
	}
	/**
	 * @return Returns the error.
	 */
	public String getError() {
		return error;
	}
	/**
	 * @param error The error to set.
	 */
	public void setError(String error) {
		this.error = error;
	}
	/**
	 * @return Returns the logDate.
	 */
	public String getLogDate() {
		return logDate;
	}
	/**
	 * @param logDate The logDate to set.
	 */
	public void setLogDate(String logDate) {
		this.logDate = logDate;
	}
	/**
	 * @return Returns the raw.
	 */
	public String getRaw() {
		return raw;
	}
	/**
	 * @param raw The rawdata to set.
	 */
	public void setRaw(String raw) {
		this.raw = raw; //view
	}
	/**
	 * @return Returns the type.
	 */
	public String getType() {
		return type;
	}
	/**
	 * @param type The type to set.
	 */
	public void setType(String type) {
		this.type = type;
	}	
	/**
	 * @return Returns the facilityName.
	 */
	public String getFacilityName() {
		return facilityName;
	}
	/**
	 * @param facilityName The facilityName to set.
	 */
	public void setFacilityName(String facilityName) {
		this.facilityName = facilityName;
	}
	
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	//Orders the objects in the order
	public int compareTo(Object obj)
	{
		MessageLogBean other = (MessageLogBean) obj;
		int order = 0;
		if (getCreateDate() != null && other.getCreateDate() != null)
		{
			//descending
			order = other.getCreateDate().compareTo(getCreateDate());
		}
		if (order == 0) {
			//Ascending
			String thisString = this.facilityName + this.type;
			String otherString = other.facilityName + other.type;
			order = thisString.compareTo(otherString);
		}		
		return order;
	}
}
