public abstract class AbstractVersionedEntityObject extends ConfluenceEntityObject implements Versioned, Cloneable
Modifier and Type | Field and Description |
---|---|
protected static int |
INITIAL_VERSION |
Constructor and Description |
---|
AbstractVersionedEntityObject() |
Modifier and Type | Method and Description |
---|---|
void |
applyChildVersioningPolicy(Versioned versionToPromote,
ObjectDao dao)
Deprecated.
since 6.10.0. Use
applyChildVersioningPolicy(Versioned, ObjectDaoInternal) instead. |
void |
applyChildVersioningPolicy(@Nullable Versioned versionToPromote,
ObjectDaoInternal<?> dao)
If
Versioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType) specifies so, moves content from versionToPromote to this Versioned instance or
makes no change. |
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 right
VersionChildOwnerPolicy 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.
|
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
protected static final int INITIAL_VERSION
public int getVersion()
Versioned
getVersion
in interface Versioned
public void setVersion(int version)
Versioned
setVersion
in interface Versioned
version
- the new version number for this version of the object.public boolean isNew()
Versioned
public void setOriginalVersion(Versioned originalVersion)
Versioned
setOriginalVersion
in interface Versioned
originalVersion
- the current version of this object.public Versioned getLatestVersion()
Versioned
Note that drafts are a special version of a ContentEntityObject
so for drafts this method should return the ContentEntityObject
the drafts points to if it exists and the draft itself otherwise.
getLatestVersion
in interface Versioned
ContentEntityObject.DRAFT
public void convertToHistoricalVersion()
Versioned
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.
convertToHistoricalVersion
in interface Versioned
@Deprecated public void applyChildVersioningPolicy(Versioned versionToPromote, ObjectDao dao)
applyChildVersioningPolicy(Versioned, ObjectDaoInternal)
instead.Versioned
Versioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
specifies so, moves content from versionToPromote to this Versioned instance or
makes no change.applyChildVersioningPolicy
in interface Versioned
versionToPromote
- the new version of the current instance that we're getting the children fromdao
- dao used to delete dangling contained contentpublic void applyChildVersioningPolicy(@Nullable Versioned versionToPromote, ObjectDaoInternal<?> dao)
Versioned
Versioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
specifies so, moves content from versionToPromote to this Versioned instance or
makes no change.applyChildVersioningPolicy
in interface Versioned
versionToPromote
- the new version of the current instance that we're getting the children fromdao
- dao used to delete dangling contained contentpublic boolean isLatestVersion()
isLatestVersion
in interface Versioned
public VersionChildOwnerPolicy getVersionChildPolicy(ContentType contentType)
Versioned
VersionChildOwnerPolicy
depending on the passed contentType.
By default, VersionChildOwnerPolicy.currentVersion
is returned
Right now, this is only enforced for children with content type Attachment or Comment
getVersionChildPolicy
in interface Versioned
protected String getConfluenceRevision()
Copyright © 2003–2020 Atlassian. All rights reserved.