root/trunk/cdmlib/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/view/AuditEvent.java

Revision 9702, 2.2 kB (checked in by a.mueller, 22 months ago)

minor

  • Property svn:keywords set to Id
Line 
1/**
2* Copyright (C) 2009 EDIT
3* European Distributed Institute of Taxonomy
4* http://www.e-taxonomy.eu
5*
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.
8*/ 
9
10package eu.etaxonomy.cdm.model.view;
11
12import java.io.Serializable;
13import java.util.UUID;
14
15import javax.persistence.Basic;
16import javax.persistence.Entity;
17import javax.persistence.FetchType;
18import javax.persistence.GeneratedValue;
19import javax.persistence.Id;
20
21import org.hibernate.annotations.Type;
22import org.hibernate.envers.RevisionEntity;
23import org.hibernate.envers.RevisionNumber;
24import org.hibernate.envers.RevisionTimestamp;
25import org.joda.time.DateTime;
26
27@Entity
28@RevisionEntity
29public class AuditEvent implements Serializable {
30/**
31         *
32         */
33        private static final long serialVersionUID = 6584537382484488953L;
34
35        public static final AuditEvent CURRENT_VIEW;
36       
37        static {
38                CURRENT_VIEW = new AuditEvent();
39                CURRENT_VIEW.setUuid(UUID.fromString("966728f0-ae51-11dd-ad8b-0800200c9a66"));
40        };
41       
42        @Type(type="uuidUserType")
43        private UUID uuid;
44       
45        public UUID getUuid() {
46                return uuid;
47        }
48
49        public Long getTimestamp() {
50                return timestamp;
51        }
52
53        public AuditEvent() {
54                this.uuid = UUID.randomUUID();
55                this.date = new DateTime();
56        }
57       
58        @Type(type="dateTimeUserType")
59        @Basic(fetch = FetchType.LAZY)
60        private DateTime date;
61       
62        public DateTime getDate() {
63                return date;
64        }
65       
66        public void setDate(DateTime date) {
67                this.date = date;
68        }
69
70        @Id
71        @GeneratedValue
72        @RevisionNumber
73        private Integer revisionNumber;
74       
75        @RevisionTimestamp
76        private Long timestamp;
77
78        public Integer getRevisionNumber() {
79                return revisionNumber;
80        }
81       
82        public void setUuid(UUID uuid) {
83                this.uuid = uuid;
84        }
85       
86        public boolean equals(Object obj) {
87                if(this == obj)
88                    return true;
89                       
90                if((obj == null) || (obj.getClass() != this.getClass()))
91                    return false;
92                       
93                AuditEvent auditEvent = (AuditEvent) obj;
94                    return uuid == auditEvent.uuid || (uuid != null && uuid.equals(auditEvent.uuid));           
95        }
96                       
97        public int hashCode() {
98                int hash = 7;
99                hash = 31 * hash + (null == uuid ? 0 : uuid.hashCode());
100                return hash;
101        }
102
103        public void setRevisionNumber(Integer revisionNumber) {
104                this.revisionNumber = revisionNumber;
105        }
106}
Note: See TracBrowser for help on using the browser.