Interface AssetVersionManager


  • @ProviderType
    public interface AssetVersionManager
    AssetVersionManager provides methods to manage AssetVersions.

    AssetVersionManager is created by adapting ResourceResolver to AssetVersionManager

         AssetVersionManager versionManager = resolver.adaptTo(AssetVersionManager.class);
     
    • Method Detail

      • createVersion

        AssetVersion createVersion​(String assetPath,
                                   String label)
        Creates a new version of an Asset.
        Parameters:
        assetPath - Absolute path of the asset to version
        label - Version label to be added to the newly created version
        Returns:
        The newly created AssetVersion
        Throws:
        AssetException - if version cannot be created.
      • restore

        Asset restore​(String versionId)
        Restores an Asset.
        Parameters:
        versionId - version ID to be restored
        Returns:
        the restored Asset
        Throws:
        AssetException - if version with the given ID cannot be restored
      • getVersion

        AssetVersion getVersion​(String versionId)
        Returns an AssetVersion corresponding to the given versionId.
        Parameters:
        versionId - version ID to be looked up
        Returns:
        the AssetVersion matching the given versionId
      • listVersions

        Iterator<? extends AssetVersion> listVersions​(String assetPath)
        Lists all available versions at the given path.
        Parameters:
        assetPath - Absolute path of the Asset
        Returns:
        all AssetVersions of the given path or an empty iterator if no version has been created yet
        Throws:
        AssetException - if versions cannot be retrieved for the given Asset path