public class ComponentRollbackConverter extends java.lang.Object implements ItemRollbackConverter
| Constructor and Description |
|---|
ComponentRollbackConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected CMSComponentService |
getCmsComponentService() |
protected CMSItemCloningService |
getCmsItemCloningService() |
protected CMSPageService |
getCmsPageService() |
protected CMSVersionService |
getCmsVersionService() |
java.util.function.Predicate<ItemModel> |
getConstrainedBy()
Predicate to verify whether current converter is applicable to provided
ItemModel. |
protected ItemModel |
getItemModelFromPk(java.lang.String pk)
This method retrieves the
ItemModel represented by the provided PK. |
protected ModelService |
getModelService() |
protected java.util.Set<ContentSlotModel> |
getPageSlots(AbstractPageModel page)
This method retrieves the content slots that directly belong to the provided page (it does not return slots coming from
a template).
|
protected TypeService |
getTypeService() |
protected java.util.Set<java.lang.String> |
getVersionedSlotsUids(AuditPayload componentPayload)
This method retrieves the uid of the versioned slots stored in the provided payload.
|
protected boolean |
isAssignableFromVersion(java.lang.String itemTypeCode)
This method checks if the the itemTypeCode is a super type of
CMSVersionModel OR the same type. |
protected boolean |
isPkSlotInPage(java.lang.String slotPk,
java.util.Set<java.lang.String> slotsInPageUid)
This method determines if the given pk represents one of the slots in the current page.
|
protected java.util.List<java.lang.String> |
readSlotsFromComponentPayload(AuditPayload componentPayload)
This method returns a list containing the pk of each of the slots found in the given component payload.
|
protected void |
removeSlotsOutsidePageFromPayload(java.util.Set<ContentSlotModel> slotsInPage,
AuditPayload componentPayload)
This method removes from the payload any slot outside the current page.
|
protected AbstractCMSComponentModel |
replaceComponentWithCloneInPage(AbstractCMSComponentModel originalComponent,
AbstractPageModel page,
AuditPayload componentPayload)
This method creates a clone of the given component and uses it to replace all the references of the original component in
the version of the page provided, as indicated by the payload.
|
protected void |
rollbackComponentOnlyInPage(AbstractCMSComponentModel component,
AbstractPageModel page,
AuditPayload componentPayload)
This method rollbacks the component only in slots of the version of the page provided, as indicated by the payload.
|
AbstractCMSComponentModel |
rollbackItem(ItemModel itemModel,
CMSVersionModel version,
AuditPayload auditPayload)
Rollbacks the itemModel to a desired version based on the information specified in the audit payload.
|
void |
setCmsComponentService(CMSComponentService cmsComponentService) |
void |
setCmsItemCloningService(CMSItemCloningService cmsItemCloningService) |
void |
setCmsPageService(CMSPageService cmsPageService) |
void |
setCmsVersionService(CMSVersionService cmsVersionService) |
void |
setConstrainedBy(java.util.function.Predicate<ItemModel> constrainedBy) |
void |
setModelService(ModelService modelService) |
void |
setTypeService(TypeService typeService) |
protected void |
updatePayloadForClonedComponent(AbstractCMSComponentModel clonedComponent,
AuditPayload componentPayload)
This method updates the component payload to match the cloned component information.
|
public AbstractCMSComponentModel rollbackItem(ItemModel itemModel, CMSVersionModel version, AuditPayload auditPayload) throws ItemRollbackException
ItemRollbackConverterrollbackItem in interface ItemRollbackConverteritemModel - The ItemModel to rollback.version - The CMSVersionModel that identifies the version of the item to rollback to.auditPayload - The serialized payload that specifies the information that the versioned item must contain.ItemModel.ItemRollbackException - if the ItemModel referenced cannot be rolled back.protected AbstractCMSComponentModel replaceComponentWithCloneInPage(AbstractCMSComponentModel originalComponent, AbstractPageModel page, AuditPayload componentPayload) throws ItemRollbackException
originalComponent - - The component to clone.page - - The page where to replace the original component with a rollbacked clonecomponentPayload - - The serialized payload that specifies the information that the versioned component must contain.ItemRollbackException - if the original component cannot be cloned to be safely rolled back.protected void rollbackComponentOnlyInPage(AbstractCMSComponentModel component, AbstractPageModel page, AuditPayload componentPayload)
component - - The component to rollback.page - - The page where to rollback the provided component.componentPayload - - The serialized payload that specifies the information that the versioned component must contain.protected void updatePayloadForClonedComponent(AbstractCMSComponentModel clonedComponent, AuditPayload componentPayload)
clonedComponent - - The component instance that will be rollbacked.componentPayload - - The serialized payload that specifies the information that the versioned component must contain.protected java.util.Set<ContentSlotModel> getPageSlots(AbstractPageModel page)
page - - The page whose slots to retrieve.Set containing the slots in the page.protected java.util.Set<java.lang.String> getVersionedSlotsUids(AuditPayload componentPayload)
componentPayload - - The payload from where to read the list of versioned slots.Set containing the uids of the versioned slots.protected void removeSlotsOutsidePageFromPayload(java.util.Set<ContentSlotModel> slotsInPage, AuditPayload componentPayload)
slotsInPage - - The slots of the current page. Doesn't contain any shared slot.componentPayload - - The payload where to remove slots outside the current page.protected boolean isPkSlotInPage(java.lang.String slotPk,
java.util.Set<java.lang.String> slotsInPageUid)
slotPk - - the pk to check.slotsInPageUid - - the slots of the current page. Doesn't contain any shared slot.protected java.util.List<java.lang.String> readSlotsFromComponentPayload(AuditPayload componentPayload)
componentPayload - - the payload of the component from where to read the list of slots.protected ItemModel getItemModelFromPk(java.lang.String pk)
ItemModel represented by the provided PK.pk - - the pk whose item model to retrieveprotected boolean isAssignableFromVersion(java.lang.String itemTypeCode)
CMSVersionModel OR the same type.itemTypeCode - - The type code to check.true if the itemTypeCode is a super type of CMSVersionModel OR the same type,
false otherwise.protected CMSVersionService getCmsVersionService()
public void setCmsVersionService(CMSVersionService cmsVersionService)
protected CMSItemCloningService getCmsItemCloningService()
public void setCmsItemCloningService(CMSItemCloningService cmsItemCloningService)
protected CMSComponentService getCmsComponentService()
public void setCmsComponentService(CMSComponentService cmsComponentService)
protected CMSPageService getCmsPageService()
public void setCmsPageService(CMSPageService cmsPageService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected TypeService getTypeService()
public void setTypeService(TypeService typeService)
public java.util.function.Predicate<ItemModel> getConstrainedBy()
ItemRollbackConverterItemModel.getConstrainedBy in interface ItemRollbackConverterPredicate.public void setConstrainedBy(java.util.function.Predicate<ItemModel> constrainedBy)
Copyright © 2018 SAP SE. All Rights Reserved.