public interface CMSVersionService
ItemModel.| Modifier and Type | Method and Description |
|---|---|
ItemModel |
createItemFromVersion(CMSVersionModel version)
Creates a new
ItemModel and populates the item model using the data saved in the CMSVersionModel. |
CMSVersionModel |
createRevisionForItem(CMSItemModel itemModel)
Creates a revision for the given item and updates its payload.
|
CMSVersionModel |
createVersionForItem(CMSItemModel itemModel,
java.lang.String label,
java.lang.String description)
Creates a version for the given item and updates its payload.
|
void |
deleteVersionsForItem(CMSItemModel itemModel)
Deletes all tagged versions for a
CMSItemModel. |
java.util.Optional<AbstractPageModel> |
findPageVersionedByTransactionId(java.lang.String transactionId)
Finds the page associated to a transaction ID.
|
java.lang.String |
generateVersionUid()
Generates version uid using versionUidGenerator.
|
ItemModel |
getItemFromVersion(CMSVersionModel version)
Retrieves an existing
ItemModel and populates the item model using the data saved in the
CMSVersionModel. |
java.lang.String |
getTransactionId()
Returns the version ID stored in the session attribute
SessionService
Cms2Constants.SESSION_VERSION_TRANSACTION_ID. |
java.util.Optional<CMSVersionModel> |
getVersionByLabel(CMSItemModel itemModel,
java.lang.String label)
Finds the {code CMSVersionModel} containing the provided label for a given item.
|
java.util.Optional<CMSVersionModel> |
getVersionByUid(java.lang.String uid)
Finds the {code CMSVersionModel} by uid.
|
boolean |
isVersionable(CMSItemModel itemModel)
Determines if an itemModel is versionable
|
java.util.Optional<ItemModel> |
rollbackVersionForUid(java.lang.String uid)
Rolls back an
ItemModel to a specific version. |
ItemModel createItemFromVersion(CMSVersionModel version)
ItemModel and populates the item model using the data saved in the CMSVersionModel.version - The version used to create an ItemModelItemModel created from the version payloadItemModel getItemFromVersion(CMSVersionModel version)
ItemModel and populates the item model using the data saved in the
CMSVersionModel.version - The version used to retrieve an ItemModelItemModel updated with the data from the version payloadjava.util.Optional<CMSVersionModel> getVersionByUid(java.lang.String uid)
uid - The uid of the CMSVersion modelOptional#empty()java.util.Optional<CMSVersionModel> getVersionByLabel(CMSItemModel itemModel, java.lang.String label)
itemModel - the item model containing all the versions to search inlabel - the label on the cms version to search forOptional#empty()java.lang.String getTransactionId()
SessionService
Cms2Constants.SESSION_VERSION_TRANSACTION_ID.CMSVersionModel createRevisionForItem(CMSItemModel itemModel)
Note that a "revision" is a CMSVersionModel without a label.
itemModel - The item model for versioning.CMSVersionModel createVersionForItem(CMSItemModel itemModel, java.lang.String label, java.lang.String description)
Note that a "version" is a CMSVersionModel with an existing label.
itemModel - The item model for versioning.label - The label for the versiondescription - The description for the versionjava.util.Optional<ItemModel> rollbackVersionForUid(java.lang.String uid)
ItemModel to a specific version. If no version is found, an Optional#empty() is
returned.uid - The uid of the CMSVersionModel which the ItemModel will be rolled back toOptional containing the updated ItemModel after it was rolled back; can be
Optional#empty() when no version is found to perform the rollback operation.boolean isVersionable(CMSItemModel itemModel)
itemModel - The item model.java.lang.String generateVersionUid()
void deleteVersionsForItem(CMSItemModel itemModel)
CMSItemModel. Does not delete orphaned aggregated types linked to the
item by relations. They will be deleted by garbage collection if enabled.itemModel - the item model for which all related tagged versions will be deletedjava.util.Optional<AbstractPageModel> findPageVersionedByTransactionId(java.lang.String transactionId)
When a page is versioned, the page and all its associated items are versioned. Each of them has a different version, but they all share the same transactionId; only one page can be associated to a transaction ID.
transactionId - The ID of the transaction for which to find its associated page.Optional containing the page associated to the given transactionId; can be
Optional#empty() when the transactionId identifies a transaction where a page was not versioned.Copyright © 2018 SAP SE. All Rights Reserved.