Package com.atlassian.confluence.core
Class AbstractVersionedEntityObject
java.lang.Object
com.atlassian.core.bean.EntityObject
com.atlassian.confluence.core.AnnotatedEntityObject
com.atlassian.confluence.core.ConfluenceEntityObject
com.atlassian.confluence.core.AbstractVersionedEntityObject
- All Implemented Interfaces:
Versioned
,Serializable
,Cloneable
- Direct Known Subclasses:
AbstractLabelableEntityObject
public abstract class AbstractVersionedEntityObject
extends ConfluenceEntityObject
implements Versioned, Cloneable
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Remove all data from the object that does not need to be saved by historical versions.protected String
Get the latest, current version of this versioned object.int
Return the version number of this version of the object.getVersionChildPolicy
(ContentType contentType) Returns the rightVersionChildOwnerPolicy
depending on the passed contentType.boolean
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.confluence.core.AnnotatedEntityObject
getCreationDate, getLastModificationDate
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, equals, getCurrentDate, getId, hashCode, setClock, setCreationDate, setId, setLastModificationDate
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.confluence.core.Versioned
applyChildVersioningPolicy
-
Field Details
-
INITIAL_VERSION
protected static final int INITIAL_VERSION- See Also:
-
-
Constructor Details
-
AbstractVersionedEntityObject
public AbstractVersionedEntityObject()
-
-
Method Details
-
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 interfaceVersioned
- 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 interfaceVersioned
- 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? -
setOriginalVersion
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 interfaceVersioned
- Parameters:
originalVersion
- the current version of this object.
-
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.Note that drafts are a special version of a
ContentEntityObject
so for drafts this method should return theContentEntityObject
the drafts points to if it exists and the draft itself otherwise.- Specified by:
getLatestVersion
in interfaceVersioned
- Returns:
- the current version of this object.
- See Also:
-
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 interfaceVersioned
-
isLatestVersion
public boolean isLatestVersion()- Specified by:
isLatestVersion
in interfaceVersioned
- Returns:
- true if this is the latest (current) version of the object, false if it is an historical version.
-
getVersionChildPolicy
Description copied from interface:Versioned
Returns the rightVersionChildOwnerPolicy
depending on the passed contentType. By default,VersionChildOwnerPolicy.currentVersion
is returnedRight now, this is only enforced for children with content type Attachment or Comment
- Specified by:
getVersionChildPolicy
in interfaceVersioned
-
getConfluenceRevision
-