public class DefaultCMSVersionService extends java.lang.Object implements CMSVersionService
CMSVersionService| Constructor and Description |
|---|
DefaultCMSVersionService() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
belongsToPage(CMSItemModel itemModel)
Determines if the item is a content slot defined for the page (ContentSlotForPage relation) or the page template
(ContentSlotForTemplate relation).
|
protected void |
checkChangeTypePermission(java.lang.String typeCode)
Checks whether current user has CHANGE type permission for typeCode;
|
protected void |
checkCreateTypePermission(java.lang.String typeCode)
Checks whether current user has CREATE type permission for typeCode;
|
protected void |
checkReadTypePermission(java.lang.String typeCode)
Checks whether current user has READ type permission for typeCode;
|
protected void |
checkRemoveTypePermission(java.lang.String typeCode)
Checks whether current user has REMOVE type permission for typeCode;
|
ItemModel |
createItemFromVersion(CMSVersionModel version)
Creates a new
ItemModel and populates the item model using the data saved in the CMSVersionModel. |
protected CMSVersionModel |
createPartialVersionForItem(CMSItemModel itemModel)
Generates a partial version for ItemModel.
|
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.
|
protected java.lang.String |
generatePayloadForVersion(CMSVersionModel version)
Generates a payload for a version.
|
protected java.lang.String |
generateTransactionId()
Generates transaction id using transactionIdGenerator.
|
java.lang.String |
generateVersionUid()
Generates version uid using versionUidGenerator.
|
CMSAdminContentSlotService |
getCmsAdminContentSlotService() |
protected CMSAdminItemService |
getCmsAdminItemService() |
protected CMSAdminSiteService |
getCmsAdminSiteService() |
protected CMSItemModel |
getCMSItemByVersion(CMSVersionModel version) |
SessionSearchRestrictionsDisabler |
getCmsSessionSearchRestrictionsDisabler() |
protected CMSVersionDao |
getCmsVersionDao() |
protected CMSVersionSessionContextProvider |
getCmsVersionSessionContextProvider() |
protected Converter<ItemModel,java.lang.String> |
getCmsVersionToDataConverter() |
protected Converter<CMSVersionModel,ItemModel> |
getCmsVersionToModelPreviewConverter() |
Converter<CMSVersionModel,ItemModel> |
getCmsVersionToModelRollbackConverter() |
ItemModel |
getItemFromVersion(CMSVersionModel version)
Retrieves an existing
ItemModel and populates the item model using the data saved in the
CMSVersionModel. |
protected ModelService |
getModelService() |
protected PermissionCRUDService |
getPermissionCRUDService() |
protected SessionService |
getSessionService() |
java.lang.String |
getTransactionId()
Returns the version ID stored in the session attribute
SessionService
Cms2Constants.SESSION_VERSION_TRANSACTION_ID. |
protected PersistentKeyGenerator |
getTransactionIdGenerator() |
protected TypeService |
getTypeService() |
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.
|
protected java.util.List<CMSVersionModel> |
getVersionsForItem(CMSItemModel itemModel)
Finds all
CMSVersionModel versions for a given CMSItemModel |
protected PersistentKeyGenerator |
getVersionUidGenerator() |
protected boolean |
isInActiveSessionCatalog(CMSItemModel itemModel)
Determines if the item is defined in the current (active session) catalog version or in a parent catalog
(multi-country).
|
protected boolean |
isPreview() |
protected boolean |
isTaggedVersion(CMSVersionModel cmsVersionModel)
Determines if the cms version is tagged
|
boolean |
isVersionable(CMSItemModel itemModel)
Determines if an itemModel is versionable
|
protected void |
restoreHomepageAttribute(ItemModel itemModel)
Restore homepage attribute for Content pages to use the vale from the original page.
|
java.util.Optional<ItemModel> |
rollbackVersionForUid(java.lang.String uid)
Rolls back an
ItemModel to a specific version. |
void |
setCmsAdminContentSlotService(CMSAdminContentSlotService cmsAdminContentSlotService) |
void |
setCmsAdminItemService(CMSAdminItemService cmsAdminItemService) |
void |
setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService) |
void |
setCmsSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler cmsSessionSearchRestrictionsDisabler) |
void |
setCmsVersionDao(CMSVersionDao cmsVersionDao) |
void |
setCmsVersionSessionContextProvider(CMSVersionSessionContextProvider cmsVersionSessionContextProvider) |
void |
setCmsVersionToDataConverter(Converter<ItemModel,java.lang.String> cmsVersionToDataConverter) |
void |
setCmsVersionToModelPreviewConverter(Converter<CMSVersionModel,ItemModel> cmsVersionToModelPreviewConverter) |
void |
setCmsVersionToModelRollbackConverter(Converter<CMSVersionModel,ItemModel> cmsVersionToModelRollbackConverter) |
void |
setModelService(ModelService modelService) |
void |
setPermissionCRUDService(PermissionCRUDService permissionCRUDService) |
void |
setSessionService(SessionService sessionService) |
void |
setTransactionIdGenerator(PersistentKeyGenerator transactionIdGenerator) |
void |
setTypeService(TypeService typeService) |
void |
setVersionUidGenerator(PersistentKeyGenerator versionUidGenerator) |
protected void |
throwTypePermissionException(java.lang.String permissionName,
java.lang.String typeCode)
Throws
TypePermissionException if current user does not have permission for typeCode. |
protected java.lang.String generatePayloadForVersion(CMSVersionModel version)
version - The CMSVersion model.public ItemModel createItemFromVersion(CMSVersionModel version)
ItemModel and populates the item model using the data saved in the CMSVersionModel. ItemModel to the persistence store, including any
ItemModel's that are in relationship with the target ItemModel.createItemFromVersion in interface CMSVersionServiceversion - The version used to create an ItemModelItemModel created from the version payloadpublic ItemModel getItemFromVersion(CMSVersionModel version)
ItemModel and populates the item model using the data saved in the
CMSVersionModel. ItemModel and any ItemModel's that are in
relationship with the target.getItemFromVersion in interface CMSVersionServiceversion - The version used to retrieve an ItemModelItemModel updated with the data from the version payloadpublic java.util.Optional<CMSVersionModel> getVersionByUid(java.lang.String uid)
CMSVersionServicegetVersionByUid in interface CMSVersionServiceuid - The uid of the CMSVersion modelOptional#empty()public java.util.Optional<CMSVersionModel> getVersionByLabel(CMSItemModel itemModel, java.lang.String label)
CMSVersionServicegetVersionByLabel in interface CMSVersionServiceitemModel - the item model containing all the versions to search inlabel - the label on the cms version to search forOptional#empty()protected java.util.List<CMSVersionModel> getVersionsForItem(CMSItemModel itemModel)
CMSVersionModel versions for a given CMSItemModelitemModel - the item model for which to return all versionsCMSVersionModelpublic java.lang.String getTransactionId()
CMSVersionServiceSessionService
Cms2Constants.SESSION_VERSION_TRANSACTION_ID.getTransactionId in interface CMSVersionServicepublic CMSVersionModel createRevisionForItem(CMSItemModel itemModel)
CMSVersionService
Note that a "revision" is a CMSVersionModel without a label.
createRevisionForItem in interface CMSVersionServiceitemModel - The item model for versioning.public CMSVersionModel createVersionForItem(CMSItemModel itemModel, java.lang.String label, java.lang.String description)
CMSVersionService
Note that a "version" is a CMSVersionModel with an existing label.
createVersionForItem in interface CMSVersionServiceitemModel - The item model for versioning.label - The label for the versiondescription - The description for the versionpublic java.util.Optional<ItemModel> rollbackVersionForUid(java.lang.String uid)
CMSVersionServiceItemModel to a specific version. If no version is found, an Optional#empty() is
returned.rollbackVersionForUid in interface CMSVersionServiceuid - 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.protected boolean isPreview()
protected void restoreHomepageAttribute(ItemModel itemModel)
itemModel - the item model.protected CMSVersionModel createPartialVersionForItem(CMSItemModel itemModel)
itemModel - The item model for versioning.public java.lang.String generateVersionUid()
generateVersionUid in interface CMSVersionServicepublic boolean isVersionable(CMSItemModel itemModel)
isVersionable in interface CMSVersionServiceitemModel - The item model.public void deleteVersionsForItem(CMSItemModel itemModel)
CMSVersionServiceCMSItemModel. Does not delete orphaned aggregated types linked to the
item by relations. They will be deleted by garbage collection if enabled.deleteVersionsForItem in interface CMSVersionServiceitemModel - the item model for which all related tagged versions will be deletedpublic java.util.Optional<AbstractPageModel> findPageVersionedByTransactionId(java.lang.String transactionId)
CMSVersionServiceWhen 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.
findPageVersionedByTransactionId in interface CMSVersionServicetransactionId - 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.protected boolean isTaggedVersion(CMSVersionModel cmsVersionModel)
cmsVersionModel - the cms versionprotected boolean isInActiveSessionCatalog(CMSItemModel itemModel)
itemModel - the item to be evaluatedprotected boolean belongsToPage(CMSItemModel itemModel)
itemModel - the item to be evaluatedprotected java.lang.String generateTransactionId()
protected CMSItemModel getCMSItemByVersion(CMSVersionModel version)
protected void checkReadTypePermission(java.lang.String typeCode)
typeCode - the type codeprotected void checkCreateTypePermission(java.lang.String typeCode)
typeCode - the type codeprotected void checkRemoveTypePermission(java.lang.String typeCode)
typeCode - the type codeprotected void checkChangeTypePermission(java.lang.String typeCode)
typeCode - the type codeprotected void throwTypePermissionException(java.lang.String permissionName,
java.lang.String typeCode)
TypePermissionException if current user does not have permission for typeCode.permissionName - typeCode - protected PersistentKeyGenerator getVersionUidGenerator()
public void setVersionUidGenerator(PersistentKeyGenerator versionUidGenerator)
protected PersistentKeyGenerator getTransactionIdGenerator()
public void setTransactionIdGenerator(PersistentKeyGenerator transactionIdGenerator)
protected SessionService getSessionService()
public void setSessionService(SessionService sessionService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected TypeService getTypeService()
public void setTypeService(TypeService typeService)
protected CMSAdminItemService getCmsAdminItemService()
public void setCmsAdminItemService(CMSAdminItemService cmsAdminItemService)
protected CMSVersionDao getCmsVersionDao()
public void setCmsVersionDao(CMSVersionDao cmsVersionDao)
public CMSAdminContentSlotService getCmsAdminContentSlotService()
public void setCmsAdminContentSlotService(CMSAdminContentSlotService cmsAdminContentSlotService)
protected CMSAdminSiteService getCmsAdminSiteService()
public void setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
protected Converter<ItemModel,java.lang.String> getCmsVersionToDataConverter()
public void setCmsVersionToDataConverter(Converter<ItemModel,java.lang.String> cmsVersionToDataConverter)
protected Converter<CMSVersionModel,ItemModel> getCmsVersionToModelPreviewConverter()
public void setCmsVersionToModelPreviewConverter(Converter<CMSVersionModel,ItemModel> cmsVersionToModelPreviewConverter)
protected CMSVersionSessionContextProvider getCmsVersionSessionContextProvider()
public void setCmsVersionSessionContextProvider(CMSVersionSessionContextProvider cmsVersionSessionContextProvider)
public SessionSearchRestrictionsDisabler getCmsSessionSearchRestrictionsDisabler()
public void setCmsSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler cmsSessionSearchRestrictionsDisabler)
public Converter<CMSVersionModel,ItemModel> getCmsVersionToModelRollbackConverter()
public void setCmsVersionToModelRollbackConverter(Converter<CMSVersionModel,ItemModel> cmsVersionToModelRollbackConverter)
protected PermissionCRUDService getPermissionCRUDService()
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
Copyright © 2018 SAP SE. All Rights Reserved.