View Javadoc
1   package org.myorg.encconfig.bo;
2   
3   import java.text.DateFormat;
4   import java.text.SimpleDateFormat;
5   import java.util.Date;
6   
7   import javax.persistence.Column;
8   import javax.persistence.Entity;
9   import javax.persistence.GeneratedValue;
10  import javax.persistence.Id;
11  import javax.persistence.Table;
12  import javax.persistence.Temporal;
13  import javax.persistence.TemporalType;
14  
15  @Entity
16  @Table(name="EJBCONFIG_AUDITREC")
17  public class AuditRecord {
18  	@Id @GeneratedValue
19  	private int id;
20  	@Temporal(TemporalType.TIMESTAMP)
21  	@Column(nullable=false)
22  	private Date timestamp;
23  	@Column(length=200, nullable=false)
24  	private String message;
25  	
26  	protected AuditRecord(){}
27  	public AuditRecord(Date timestamp, String message) {
28  		this.timestamp = timestamp;
29  		this.message = message;
30  	}
31  	
32  	public int getId() { return id; }
33  	public Date getTimestamp() { return timestamp; }
34  	public void setTimestamp(Date timestamp) {
35  		this.timestamp = timestamp;
36  	}
37  	
38  	public String getMessage() { return message; }
39  	public void setMessage(String message) {
40  		this.message = message;
41  	}
42  	
43  	@Override
44  	public String toString() {
45  		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
46  		return (timestamp==null?null : df.format(timestamp)) + 
47  				", " + message;
48  	}
49  }