6632ad7d8b6f9b1d02c750c57de9fc52adbefd31
2 * Copyright (C) 2007 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
.common
;
13 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
14 import eu
.etaxonomy
.cdm
.model
.view
.View
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.hibernate
.annotations
.Cascade
;
17 import org
.hibernate
.annotations
.CascadeType
;
20 import javax
.persistence
.*;
25 * @created 08-Nov-2007 13:07:01
28 public abstract class VersionableEntity
<T
extends VersionableEntity
> extends CdmBase
{
29 static Logger logger
= Logger
.getLogger(VersionableEntity
.class);
30 //the globally unique identifier
32 private Calendar created
;
33 private Person createdBy
;
34 //time of last update for this object
35 private Calendar updated
;
36 private Person updatedBy
;
37 private T nextVersion
;
38 private T previousVersion
;
40 public VersionableEntity() {
42 this.uuid
= UUID
.randomUUID().toString();
43 this.created
= Calendar
.getInstance();
47 //@OneToOne(mappedBy="previousVersion")
49 public T
getNextVersion(){
50 return this.nextVersion
;
52 public void setNextVersion(T nextVersion
){
53 this.nextVersion
= nextVersion
;
58 public T
getPreviousVersion(){
59 return this.previousVersion
;
61 public void setPreviousVersion(T previousVersion
){
62 this.previousVersion
= previousVersion
;
67 @Cascade({CascadeType
.SAVE_UPDATE
})
68 public Person
getUpdatedBy(){
69 return this.updatedBy
;
74 * @param updatedBy updatedBy
76 public void setUpdatedBy(Person updatedBy
){
77 this.updatedBy
= updatedBy
;
81 @Cascade({CascadeType
.SAVE_UPDATE
})
82 public Person
getCreatedBy(){
83 return this.createdBy
;
88 * @param createdBy createdBy
90 public void setCreatedBy(Person createdBy
){
91 this.createdBy
= createdBy
;
94 public String
getUuid(){
101 protected void setUuid(String uuid
){
105 @Temporal(TemporalType
.TIMESTAMP
)
106 public Calendar
getCreated(){
111 * @param created created
113 public void setCreated(Calendar created
){
114 this.created
= created
;
117 @Temporal(TemporalType
.TIMESTAMP
)
118 public Calendar
getUpdated(){
124 * @param updated updated
126 public void setUpdated(Calendar updated
){
127 this.updated
= updated
;
134 public Calendar
getValidFrom(){
142 public Calendar
getValidTo(){