eu.etaxonomy.cdm.model.common
Class VersionableEntity
java.lang.Object
eu.etaxonomy.cdm.model.common.CdmBase
eu.etaxonomy.cdm.model.common.VersionableEntity
- Type Parameters:
T -
- All Implemented Interfaces:
- ICdmBase, IVersionableEntity, Serializable, Cloneable
- Direct Known Subclasses:
- Address, AnnotatableEntity, Extension, FeatureNode, GenBankAccession, InstitutionalMembership, KeyStatement, Locus, Marker, MediaRepresentation, MediaRepresentationPart, PolytomousKeyNode, ReferenceIdentity, StateData, StatisticalMeasurementValue
@MappedSuperclass
public abstract class VersionableEntity
- extends CdmBase
- implements IVersionableEntity
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.
Full versioning allows concrete subclasses to keep track of previous or later versions of an object.
A different version is another (persistent) java object, but with the same UUID.
The version history is established as a linked list of the version objects in time.
If versioning via the linked list is used, updated/updatedBy is the same as created/createdBy (better NULL?).
Versioning can be turned off and in this case this class provides updated/updatedBy to keep track of the latest change event.
- Author:
- m.doering
- See Also:
- Serialized Form
| Fields inherited from class eu.etaxonomy.cdm.model.common.CdmBase |
uuid |
| Methods inherited from class eu.etaxonomy.cdm.model.common.CdmBase |
addPropertyChangeListener, addPropertyChangeListener, clone, deproxy, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCreated, getCreatedBy, getId, getUuid, hashCode, hasListeners, instanceToString, invokeSetMethod, invokeSetMethodWithNull, isInstanceOf, removePropertyChangeListener, removePropertyChangeListener, setCreated, setCreatedBy, setId, setUuid, toString |
VersionableEntity
public VersionableEntity()
getUpdatedBy
public User getUpdatedBy()
- Specified by:
getUpdatedBy in interface IVersionableEntity
setUpdatedBy
public void setUpdatedBy(User updatedBy)
- Specified by:
setUpdatedBy in interface IVersionableEntity
- Parameters:
updatedBy - updatedBy
getUpdated
public org.joda.time.DateTime getUpdated()
- Specified by:
getUpdated in interface IVersionableEntity
- Returns:
setUpdated
public void setUpdated(org.joda.time.DateTime updated)
- Specified by:
setUpdated in interface IVersionableEntity
- Parameters:
updated - updated
equals
public boolean equals(Object obj)
- Is true if UUID and created timestamp are the same for the passed Object and this one.
- Overrides:
equals in class CdmBase
- See Also:
See {@link http://www.hibernate.org/109.html hibernate109}, {@link http://www.geocities.com/technofundo/tech/java/equalhash.html geocities}
or {@link http://www.ibm.com/developerworks/java/library/j-jtp05273.html ibm}
for more information about equals and hashcode.
clone
public Object clone()
throws CloneNotSupportedException
- Clones this versionable entity.
Set fields for nextVersion, previousVersion, updated, updatedBy and createdBy are set to null
The id is set to 0.
The uuid is created new.
The createdWhen is set to the current date.
- Overrides:
clone in class CdmBase
- Throws:
CloneNotSupportedException- See Also:
Object.clone()
Copyright © 2007-2013 EDIT. All Rights Reserved.