Revision 33f9b501
Added by Markus Döring over 16 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/VersionableEntity.java | ||
---|---|---|
20 | 20 |
import javax.persistence.*; |
21 | 21 |
|
22 | 22 |
/** |
23 |
* The class keeps track of versions via a full linked list to different version objects, or a simple updated/updatedBy property in the same object. |
|
24 |
* |
|
25 |
* Full versioning allows concrete subclasses to keep track of previous or later versions of an object. |
|
26 |
* A different version is another (persistent) java object, but with the same UUID. |
|
27 |
* The version history is established as a linked list of the version objects in time. |
|
28 |
* If versioning via the linked list is used, updated/updatedBy is the same as created/createdBy (better NULL?). |
|
29 |
* |
|
30 |
* Versioning can be turned off and in this case this class provides updated/updatedBy to keep track of the latest change event. |
|
31 |
* |
|
23 | 32 |
* @author m.doering |
24 |
* @version 1.0 |
|
25 | 33 |
* @created 08-Nov-2007 13:07:01 |
34 |
* |
|
35 |
* @param <T> |
|
26 | 36 |
*/ |
27 | 37 |
@MappedSuperclass |
28 | 38 |
public abstract class VersionableEntity<T extends VersionableEntity> extends CdmBase { |
... | ... | |
34 | 44 |
private CdmBase previousVersion; |
35 | 45 |
|
36 | 46 |
|
47 |
/** |
|
48 |
* Returns the succeeding version of this object with the same UUID |
|
49 |
* @return next, i.e. succeeding version of this object |
|
50 |
*/ |
|
37 | 51 |
//@OneToOne(mappedBy="previousVersion") |
38 | 52 |
@Transient |
39 | 53 |
public CdmBase getNextVersion(){ |
... | ... | |
67 | 81 |
this.updatedBy = updatedBy; |
68 | 82 |
} |
69 | 83 |
|
84 |
/** |
|
85 |
* |
|
86 |
* @return |
|
87 |
*/ |
|
70 | 88 |
@Temporal(TemporalType.TIMESTAMP) |
71 | 89 |
@Version |
72 | 90 |
@Basic(fetch = FetchType.LAZY) |
Also available in: Unified diff