Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

/*
* ChangeLog.java
* Copyright (c) 2017 Veterans Affairs.
*/
package gov.va.oneconsult.seoc.api.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.springframework.format.annotation.DateTimeFormat;

/**
* ChangeLog Entity stores all the logs for operations to be recorded on SEOC.
*
* @author AbleVets
*
*/
@Entity
@Table(name = "Changelog")
public class ChangeLog
{
/**
* Id value. Guaranteed to be not null. Auto generated value.
*/
@Id
@Column(name = "id")
@NotNull
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;

/**
* UserId value. Guaranteed to be not null.
*/
@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.REFRESH })
@JoinColumn(name = "userid", nullable = false)
private User user;

/**
* SeocId value.
*/
@Column(name = "seocid")
private int seocId;

/**
* SeocKey value.
*/
@Column(name = "seockey")
private int seocKey;

/**
* {@link Event}
*/
@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.DETACH, CascadeType.REFRESH })
@JoinColumn(name = "eventid", nullable = false)
private Event event;

/**
* Event Date. Date value.
*/
@Column(name = "eventdate")
@DateTimeFormat(pattern = "MM-dd-yyyy")
private Date eventDate;

/**
* Comments.
*/
@NotNull
@Size(max = 500, message = "Comments should not exceed 100 characters")
private String comments;

/**
* Description: Get Id value
*
* @return - Id
*/
public int getId()
{
return id;
}

/**
* Description: Set Id value
*
* @param id
*/
public void setId(int id)
{
this.id = id;
}

/**
* Description: Get User value
*
* @return - User
*/
public User getUser()
{
return user;
}

/**
* Description: Set User value
*
* @param user
*/
public void setUser(User user)
{
this.user = user;
}

/**
* Description: Get SeocId value
*
* @return - SeocId
*/
public Integer getSeocId()
{
return seocId;
}

/**
* Description: Set SeocId value
*
* @param seocId
*/
public void setSeocId(int seocId)
{
this.seocId = seocId;
}

/**
* Description: Get SeocKey value
*
* @return - SeocKey
*/
public int getSeocKey()
{
return seocKey;
}

/**
* Description: Set SeocKey value
*
* @param seocKey
*/
public void setSeocKey(int seocKey)
{
this.seocKey = seocKey;
}

/**
* Description: Get Event value
*
* @return - Event
*/
public Event getEvent()
{
return event;
}

/**
* Description: Set Event value
*
* @param event
*/
public void setEvent(Event event)
{
this.event = event;
}

/**
* Description: Get EventDate value
*
* @return - EventDate
*/
public Date getEventDate()
{
return eventDate;
}

/**
* Description: Set EventDate value
*
* @param eventDate
*/
public void setEventDate(Date eventDate)
{
this.eventDate = eventDate;
}

/**
* Description: Get Comments value
*
* @return - Comments
*/
public String getComments()
{
return comments;
}

/**
* Description: Set Comments value
*
* @param comments
*/
public void setComments(String comments)
{
this.comments = comments;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((comments == null) ? 0 : comments.hashCode());
result = prime * result + ((eventDate == null) ? 0 : eventDate.hashCode());
result = prime * result + ((event == null) ? 0 : event.getId());
result = prime * result + id;
result = prime * result + seocId;
result = prime * result + seocKey;
result = prime * result + ((user == null) ? 0 : user.hashCode());
return result;
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ChangeLog other = (ChangeLog) obj;
if (comments == null)
{
if (other.comments != null)
return false;
} else if (!comments.equals(other.comments))
return false;
if (eventDate == null)
{
if (other.eventDate != null)
return false;
} else if (!eventDate.equals(other.eventDate))
return false;
if (event != other.event)
return false;
if (id != other.id)
return false;
if (seocId != other.seocId)
return false;
if (seocKey != other.seocKey)
return false;
if (user == null)
{
if (other.user != null)
return false;
} else if (!user.equals(other.user))
return false;
return true;
}

/**
* {@inheritDoc}
*/
@Override
public String toString()
{
return "Log [id=" + id + ", user=" + user.toString() + ", seocId=" + seocId + ", seocKey="
+ seocKey + ", event=" + event.toString() + ", eventDate=" + eventDate
+ ", comments=" + comments + "]";
}

}