com.atlassian.confluence.core
Class AbstractVersionedEntityObject

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.confluence.core.ConfluenceEntityObject
          extended by com.atlassian.confluence.core.AbstractVersionedEntityObject
All Implemented Interfaces:
Versioned, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractLabelableEntityObject

public abstract class AbstractVersionedEntityObject
extends ConfluenceEntityObject
implements Versioned, java.lang.Cloneable

See Also:
Serialized Form

Field Summary
protected static int INITIAL_VERSION
           
 
Constructor Summary
AbstractVersionedEntityObject()
           
 
Method Summary
 void convertToHistoricalVersion()
          Remove all data from the object that does not need to be saved by historical versions.
 Versioned getLatestVersion()
          Get the latest, current version of this versioned object.
 ConfluenceEntityObject getOriginalVersion()
          Deprecated. since 2.5. Use getLatestVersion() and isLatestVersion() instead.
 int getVersion()
          Return the version number of this version of the object.
 boolean isLatestVersion()
          Is this the latest version of the object? If this method returns true, then Versioned.getOriginalVersion() will return null.
 boolean isNew()
          Is this the first version of this object?
 void setOriginalVersion(Versioned originalVersion)
          Set the current version of this object.
 void setVersion(int version)
          Set the version number of this version of the object.
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
 
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, equals, getCreationDate, getCurrentDate, getId, getLastModificationDate, hashCode, setClock, setCreationDate, setId, setLastModificationDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_VERSION

protected static final int INITIAL_VERSION
See Also:
Constant Field Values
Constructor Detail

AbstractVersionedEntityObject

public AbstractVersionedEntityObject()
Method Detail

getVersion

public int getVersion()
Description copied from interface: Versioned
Return the version number of this version of the object. Version numbers are integers in ascending chronological order from 1 (the first version). Clients must not assume if two versions x and y exist, that any integer versions between x and y also exist.

Specified by:
getVersion in interface Versioned
Returns:
the version number of this version of the object

setVersion

public void setVersion(int version)
Description copied from interface: Versioned
Set the version number of this version of the object. Only call this method if you are creating a new version.

Specified by:
setVersion in interface Versioned
Parameters:
version - the new version number for this version of the object.

isNew

public boolean isNew()
Description copied from interface: Versioned
Is this the first version of this object?

Specified by:
isNew in interface Versioned
Returns:
true if this is the first version of this versioned object, false if it is a later version.

getOriginalVersion

public ConfluenceEntityObject getOriginalVersion()
Deprecated. since 2.5. Use getLatestVersion() and isLatestVersion() instead.

get the latest version of the ConfluenceEntityObject

Specified by:
getOriginalVersion in interface Versioned
Returns:
ConfluenceEntityObject

setOriginalVersion

public void setOriginalVersion(Versioned originalVersion)
Description copied from interface: Versioned
Set the current version of this object. After this method is called, this object will become an historical version of the object passed in.

Specified by:
setOriginalVersion in interface Versioned
Parameters:
originalVersion - the current version of this object.

getLatestVersion

public Versioned getLatestVersion()
Description copied from interface: Versioned
Get the latest, current version of this versioned object. If this object is the current version, return this object.

Specified by:
getLatestVersion in interface Versioned
Returns:
the current version of this object.

convertToHistoricalVersion

public void convertToHistoricalVersion()
Description copied from interface: Versioned
Remove all data from the object that does not need to be saved by historical versions. For versioned objects that are persisted, this includes removing associations with other persisted objects that may otherwise cause us to break the expected arity of the database relations.

When using Hibernate to persist versioned objects, take special care to null any field that might contain a Hibernate-persisted collection, as Hibernate does not allow two different persistent objects to refer to the same persisted collection at the same time.

Specified by:
convertToHistoricalVersion in interface Versioned

isLatestVersion

public boolean isLatestVersion()
Description copied from interface: Versioned
Is this the latest version of the object? If this method returns true, then Versioned.getOriginalVersion() will return null.

Specified by:
isLatestVersion in interface Versioned
Returns:
true if this is the latest (current) version of the object, false if it is an historical version.


Copyright © 2003-2014 Atlassian. All Rights Reserved.