Package com.atlassian.confluence.core
Class AbstractVersionedEntityObject
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
INITIAL_VERSION
-
Constructor Summary
Constructors Constructor Description AbstractVersionedEntityObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyChildVersioningPolicy(@Nullable Versioned versionToPromote, ObjectDaoInternal<?> dao)
IfVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
specifies so, moves content from versionToPromote to this Versioned instance or makes no change.void
applyChildVersioningPolicy(Versioned versionToPromote, ObjectDao dao)
Deprecated.since 6.10.0.void
convertToHistoricalVersion()
Remove all data from the object that does not need to be saved by historical versions.protected String
getConfluenceRevision()
Versioned
getLatestVersion()
Get the latest, current version of this versioned object.int
getVersion()
Return the version number of this version of the object.VersionChildOwnerPolicy
getVersionChildPolicy(ContentType contentType)
Returns the rightVersionChildOwnerPolicy
depending on the passed contentType.boolean
isLatestVersion()
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
-
-
-
-
Field Detail
-
INITIAL_VERSION
protected static final int INITIAL_VERSION
- See Also:
- Constant Field Values
-
-
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 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
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 interfaceVersioned
- 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.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:
ContentEntityObject.DRAFT
-
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
-
applyChildVersioningPolicy
@Deprecated public void applyChildVersioningPolicy(Versioned versionToPromote, ObjectDao dao)
Deprecated.since 6.10.0. UseapplyChildVersioningPolicy(Versioned, ObjectDaoInternal)
instead.Description copied from interface:Versioned
IfVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
specifies so, moves content from versionToPromote to this Versioned instance or makes no change.- Specified by:
applyChildVersioningPolicy
in interfaceVersioned
- Parameters:
versionToPromote
- the new version of the current instance that we're getting the children fromdao
- dao used to delete dangling contained content
-
applyChildVersioningPolicy
public void applyChildVersioningPolicy(@Nullable Versioned versionToPromote, ObjectDaoInternal<?> dao)
Description copied from interface:Versioned
IfVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
specifies so, moves content from versionToPromote to this Versioned instance or makes no change.- Specified by:
applyChildVersioningPolicy
in interfaceVersioned
- Parameters:
versionToPromote
- the new version of the current instance that we're getting the children fromdao
- dao used to delete dangling contained content
-
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
public VersionChildOwnerPolicy getVersionChildPolicy(ContentType contentType)
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
protected String getConfluenceRevision()
-
-