Interface CMSItemCloningService

  • All Known Implementing Classes:
    DefaultCMSItemCloningService

    public interface CMSItemCloningService
    Helper methods for cloning various items
    • Method Detail

      • cloneContentSlotComponents

        void cloneContentSlotComponents​(ContentSlotModel sourceContentSlotModel,
                                        ContentSlotModel targetContentSlotModel,
                                        CatalogVersionModel targetCatalogVersionModel)
        Deeps clones all cloneable cms components for a given content slot excluding non cloneable components
        Parameters:
        sourceContentSlotModel - - the source content slot containing the cms components
        targetContentSlotModel - - the target content slot containing the cloned cms components
        targetCatalogVersionModel - - the catalog version
      • cloneComponent

        java.util.Optional<AbstractCMSComponentModel> cloneComponent​(AbstractCMSComponentModel componentModel)
        Deep clones the provided component in the same catalog version. The cloned component will have the same information except for the pk, uid and name. The pk will be null because it is a new component. The uid and name will be generated to avoid collisions with the original component.
        Parameters:
        componentModel - - The original component to clone.
        Returns:
        The optional cloned component.
      • shouldCloneComponents

        default boolean shouldCloneComponents​(java.util.Map<java.lang.String,​java.lang.Object> context)
        Determine if components should be cloned or not by validating the value associated to the key Cms2Constants.SHOULD_CLONE_COMPONENTS_CONTEXT_KEY in the provided context Map.
        Parameters:
        context - the map containing any data specific to cloning a page
        Returns:
        true if the components of the source page's content slots should be cloned, false if they should be referenced/excluded or the context is null or empty