eu.etaxonomy.cdm.model.common
Class VersionableEntity

java.lang.Object
  extended by eu.etaxonomy.cdm.model.common.CdmBase
      extended by 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

Field Summary
 
Fields inherited from class eu.etaxonomy.cdm.model.common.CdmBase
uuid
 
Constructor Summary
VersionableEntity()
           
 
Method Summary
 Object clone()
          Clones this versionable entity.
 boolean equals(Object obj)
          Is true if UUID and created timestamp are the same for the passed Object and this one.
 org.joda.time.DateTime getUpdated()
           
 User getUpdatedBy()
           
 void setUpdated(org.joda.time.DateTime updated)
           
 void setUpdatedBy(User updatedBy)
           
 
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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface eu.etaxonomy.cdm.model.common.ICdmBase
getCreated, getCreatedBy, getId, getUuid, setCreated, setCreatedBy, setId, setUuid
 

Constructor Detail

VersionableEntity

public VersionableEntity()
Method Detail

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.