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 intINITIAL_VERSION
-
Constructor Summary
Constructors Constructor Description AbstractVersionedEntityObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidapplyChildVersioningPolicy(@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.voidapplyChildVersioningPolicy(Versioned versionToPromote, ObjectDao dao)Deprecated.since 6.10.0.voidconvertToHistoricalVersion()Remove all data from the object that does not need to be saved by historical versions.protected StringgetConfluenceRevision()VersionedgetLatestVersion()Get the latest, current version of this versioned object.intgetVersion()Return the version number of this version of the object.VersionChildOwnerPolicygetVersionChildPolicy(ContentType contentType)Returns the rightVersionChildOwnerPolicydepending on the passed contentType.booleanisLatestVersion()booleanisNew()Is this the first version of this object?voidsetOriginalVersion(Versioned originalVersion)Set the current version of this object.voidsetVersion(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:VersionedReturn 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:
getVersionin interfaceVersioned- Returns:
- the version number of this version of the object
-
setVersion
public void setVersion(int version)
Description copied from interface:VersionedSet the version number of this version of the object. Only call this method if you are creating a new version.- Specified by:
setVersionin interfaceVersioned- Parameters:
version- the new version number for this version of the object.
-
isNew
public boolean isNew()
Description copied from interface:VersionedIs this the first version of this object?
-
setOriginalVersion
public void setOriginalVersion(Versioned originalVersion)
Description copied from interface:VersionedSet 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:
setOriginalVersionin interfaceVersioned- Parameters:
originalVersion- the current version of this object.
-
getLatestVersion
public Versioned getLatestVersion()
Description copied from interface:VersionedGet 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
ContentEntityObjectso for drafts this method should return theContentEntityObjectthe drafts points to if it exists and the draft itself otherwise.- Specified by:
getLatestVersionin interfaceVersioned- Returns:
- the current version of this object.
- See Also:
ContentEntityObject.DRAFT
-
convertToHistoricalVersion
public void convertToHistoricalVersion()
Description copied from interface:VersionedRemove 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:
convertToHistoricalVersionin interfaceVersioned
-
applyChildVersioningPolicy
@Deprecated public void applyChildVersioningPolicy(Versioned versionToPromote, ObjectDao dao)
Deprecated.since 6.10.0. UseapplyChildVersioningPolicy(Versioned, ObjectDaoInternal)instead.Description copied from interface:VersionedIfVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)specifies so, moves content from versionToPromote to this Versioned instance or makes no change.- Specified by:
applyChildVersioningPolicyin 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:VersionedIfVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)specifies so, moves content from versionToPromote to this Versioned instance or makes no change.- Specified by:
applyChildVersioningPolicyin 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:
isLatestVersionin 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:VersionedReturns the rightVersionChildOwnerPolicydepending on the passed contentType. By default,VersionChildOwnerPolicy.currentVersionis returnedRight now, this is only enforced for children with content type Attachment or Comment
- Specified by:
getVersionChildPolicyin interfaceVersioned
-
getConfluenceRevision
protected String getConfluenceRevision()
-
-