2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.model
.view
;
12 import java
.io
.Serializable
;
13 import java
.util
.UUID
;
15 import javax
.persistence
.Basic
;
16 import javax
.persistence
.Entity
;
17 import javax
.persistence
.FetchType
;
18 import javax
.persistence
.GeneratedValue
;
19 import javax
.persistence
.Id
;
21 import org
.hibernate
.annotations
.Type
;
22 import org
.hibernate
.envers
.RevisionEntity
;
23 import org
.hibernate
.envers
.RevisionNumber
;
24 import org
.hibernate
.envers
.RevisionTimestamp
;
25 import org
.joda
.time
.DateTime
;
29 public class AuditEvent
implements Serializable
{
33 private static final long serialVersionUID
= 6584537382484488953L;
35 public static final AuditEvent CURRENT_VIEW
;
38 CURRENT_VIEW
= new AuditEvent();
39 CURRENT_VIEW
.setUuid(UUID
.fromString("966728f0-ae51-11dd-ad8b-0800200c9a66"));
42 @Type(type
="uuidUserType")
45 public UUID
getUuid() {
49 public Long
getTimestamp() {
54 this.uuid
= UUID
.randomUUID();
55 this.date
= new DateTime();
58 @Type(type
="dateTimeUserType")
59 @Basic(fetch
= FetchType
.LAZY
)
60 private DateTime date
;
62 public DateTime
getDate() {
66 public void setDate(DateTime date
) {
73 private Integer revisionNumber
;
76 private Long timestamp
;
78 public Integer
getRevisionNumber() {
79 return revisionNumber
;
82 public void setUuid(UUID uuid
) {
86 public boolean equals(Object obj
) {
90 if((obj
== null) || (obj
.getClass() != this.getClass()))
93 AuditEvent auditEvent
= (AuditEvent
) obj
;
94 return uuid
== auditEvent
.uuid
|| (uuid
!= null && uuid
.equals(auditEvent
.uuid
));
97 public int hashCode() {
99 hash
= 31 * hash
+ (null == uuid ?
0 : uuid
.hashCode());
103 public void setRevisionNumber(Integer revisionNumber
) {
104 this.revisionNumber
= revisionNumber
;