|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Versioned
A Confluence object that can exist in multiple versions. Only a single history of versions is allowed for any object: branching versions are not supported.
Object versioning in Confluence works in a slightly unconventional way. The identity of the 'current' object (known in the interface as the 'original' or 'latest' version) always remains the same. The object's version history consists of cloned snapshots of that object, taken before each change to its state.
Or, to give a code example:
Versioned oldVersion = (Versioned) currentObject.clone(); oldVersion.convertToHistoricalVersion(); oldVersion.setOriginalVersion(currentObject); // make changes to currentObject currentVersion.setVersion(currentVersion.getVersion() + 1); // save both objects
For Confluence persistent objects, some of the above may be handled for you by the default DAO.
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 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. |
Method Detail |
---|
int getVersion()
void setVersion(int version)
version
- the new version number for this version of the object.void convertToHistoricalVersion()
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.
boolean isNew()
@Deprecated ConfluenceEntityObject getOriginalVersion()
getLatestVersion()
and isLatestVersion()
instead.
Deprecated: This method is broken because it returns ConfluenceEntityObject
instead of Versioned
. In some future version of Confluence, this mistake will be
corrected, but the change will at the very least require that any code calling this method be
recompiled.
Versioned getLatestVersion()
void setOriginalVersion(Versioned originalVersion)
originalVersion
- the current version of this object.boolean isLatestVersion()
getOriginalVersion()
will return null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |