Interface IUnifiedRepository


  • public interface IUnifiedRepository
    Entry point into the unified repository. The finest grained object that can be read and written to this repository is a RepositoryFile.
    Author:
    mlowery
    • Method Detail

      • getFile

        RepositoryFile getFile​(String path)
        Gets file. Use this method to test for file existence too.
        Parameters:
        path - path to file
        Returns:
        file or null if the file does not exist or access is denied
      • getTree

        @Deprecated
        RepositoryFileTree getTree​(String path,
                                   int depth,
                                   String filter,
                                   boolean showHidden)
        Deprecated.
        Parameters:
        path - path to file
        depth - 0 fetches just file at path; positive integer n fetches node at path plus n levels of children; negative integer fetches all children
        filter - filter may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these; filter does not apply to root node. Filter segments can also filter the results to just Files or Folders by passing in one of the following: ( FILES | FOLDERS | [default] FILES_FOLDERS )
        showHidden - is a boolean which identify whether to include the hidden files/folders in the list or not
        Returns:
        file or null if the file does not exist or access is denied
      • getTree

        RepositoryFileTree getTree​(RepositoryRequest repositoryRequest)
        Gets a tree rooted at path.
        Parameters:
        repositoryRequest - Contains the information necessary to process the request. See the RepositoryRequest class.
        Returns:
        file or null if the file does not exist or access is denied
      • getFileAtVersion

        RepositoryFile getFileAtVersion​(Serializable fileId,
                                        Serializable versionId)
        Gets file as it was at the given version.
        Parameters:
        fileId - file id
        versionId - version id
        Returns:
        file at version
      • getFileById

        RepositoryFile getFileById​(Serializable fileId)
        Gets file. Use this method to test for file existence too.
        Parameters:
        fileId - file id
        Returns:
        file or null if the file does not exist or access is denied
      • getFile

        RepositoryFile getFile​(String path,
                               boolean loadLocaleMaps)
        Same as getFile(String) except that if loadMaps is true, the maps for localized strings will be loaded as well. (Normally these are not loaded.) Use true in editing tools that can show the maps for editing purposes.
        Parameters:
        path - path to file
        loadLocaleMaps - true to load localized string maps
        Returns:
        file or null if the file does not exist or access is denied
      • getFileById

        RepositoryFile getFileById​(Serializable fileId,
                                   boolean loadLocaleMaps)
        Same as getFile(String) except that if loadMaps is true, the maps for localized strings will be loaded as well. (Normally these are not loaded.) Use true in editing tools that can show the maps for editing purposes.
        Parameters:
        fileId - file id
        loadLocaleMaps - true to load localized string maps
        Returns:
        file or null if the file does not exist or access is denied
      • getFileById

        RepositoryFile getFileById​(Serializable fileId,
                                   boolean loadLocaleMaps,
                                   IPentahoLocale locale)
        Retrieves a file at its given version by its id
        Parameters:
        fileId - Serializable file id
        loadLocaleMaps - boolean - to determine whether to load the locale map
        locale - IPentahoLocale locale to retrieve for RepositoryFile
        Returns:
        file or null if the file does not exist or access is denied
      • createFile

        RepositoryFile createFile​(Serializable parentFolderId,
                                  RepositoryFile file,
                                  IRepositoryFileData data,
                                  String versionMessage)
        Creates a file.
        Parameters:
        parentFolderId - parent folder id
        file - file to create
        data - file data
        versionMessage - optional version comment to be applied to parentFolder
        Returns:
        file that is equal to given file except with id populated
      • createFile

        RepositoryFile createFile​(Serializable parentFolderId,
                                  RepositoryFile file,
                                  IRepositoryFileData data,
                                  RepositoryFileAcl acl,
                                  String versionMessage)
        Creates a file.
        Parameters:
        parentFolderId - parent folder id
        file - file to create
        data - file data
        acl - file acl
        versionMessage - optional version comment to be applied to parentFolder
        Returns:
        file that is equal to given file except with id populated
      • createFolder

        RepositoryFile createFolder​(Serializable parFolderId,
                                    RepositoryFile file,
                                    String versionMessage)
        Creates a folder.
        Parameters:
        parFolderId - parent folder id
        file - file to create
        versionMessage - optional version comment to be applied to parentFolder
        Returns:
        file that is equal to given file except with id populated
      • createFolder

        RepositoryFile createFolder​(Serializable parentFolderId,
                                    RepositoryFile file,
                                    RepositoryFileAcl acl,
                                    String versionMessage)
        Creates a folder.
        Parameters:
        parentFolderId - parent folder id
        file - file to create
        acl - file acl
        versionMessage - optional version comment to be applied to parentFolder
        Returns:
        file that is equal to given file except with id populated
      • updateFolder

        RepositoryFile updateFolder​(RepositoryFile folder,
                                    String versionMessage)
        Updates a file and/or the data of a file.
        Parameters:
        folder - updated folder (not a file); must have non-null id
        versionMessage - (optional) version comment
        Returns:
        updated folder (possibly with new version number)
      • getChildren

        @Deprecated
        List<RepositoryFile> getChildren​(Serializable folderId,
                                         String filter)
        Deprecated.
        Parameters:
        folderId - id of folder whose children to fetch
        filter - filter may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these
        Returns:
        list of children (never null)
      • getChildren

        @Deprecated
        List<RepositoryFile> getChildren​(Serializable folderId,
                                         String filter,
                                         Boolean showHiddenFiles)
        Deprecated.
        Parameters:
        folderId - id of folder whose children to fetch
        filter - filter may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these
        showHiddenFiles - flag determines whether to return the hidden files in he response or not
        Returns:
        list of children (never null)
      • getChildren

        List<RepositoryFile> getChildren​(RepositoryRequest repositoryRequest)
        Returns the children according to the specifications of the RepositoryRequest object
        Parameters:
        repositoryRequest - See {@link RepositoryRequest) class
        Returns:
        list of children (never null)
      • updateFile

        RepositoryFile updateFile​(RepositoryFile file,
                                  IRepositoryFileData data,
                                  String versionMessage)
        Updates a file and/or the data of a file.
        Parameters:
        file - updated file (not a folder); must have non-null id
        data - updated data
        versionMessage - (optional) version comment
        Returns:
        updated file (possibly with new version number)
      • deleteFile

        void deleteFile​(Serializable fileId,
                        boolean permanent,
                        String versionMessage)
        Deletes a file.
        Parameters:
        fileId - file id
        permanent - if true, once file is deleted, it cannot be undeleted
        versionMessage - optional version comment
      • deleteFile

        void deleteFile​(Serializable fileId,
                        String versionMessage)
        Deletes a file in a recoverable manner.
        Parameters:
        fileId - file id
        versionMessage - optional version comment
      • moveFile

        void moveFile​(Serializable fileId,
                      String destAbsPath,
                      String versionMessage)
        Moves and/or renames file. Folders are recursive. Throws exception on collision (merging does not occur).
        Parameters:
        fileId - id of file or folder to move and/or rename
        destAbsPath - path to destination; if only moving then destAbsPath will be an existing folder
        versionMessage - optional version comment to be applied to source and destination parent folders
      • copyFile

        void copyFile​(Serializable fileId,
                      String destAbsPath,
                      String versionMessage)
        Copies file. Folders are recursive. Throws exception on collision (merging does not occur).
        Parameters:
        fileId - id of file or folder to copy
        destAbsPath - path to destination; if only copying (without name change) then destAbsPath will be an existing folder
        versionMessage - optional version comment to be applied to destination parent folder
      • undeleteFile

        void undeleteFile​(Serializable fileId,
                          String versionMessage)
        Recovers a deleted file if it was not permanently deleted. File is recovered to its original folder.
        Parameters:
        fileId - deleted file id
        versionMessage - optional version comment to be applied to original parent folder
      • getDeletedFiles

        List<RepositoryFile> getDeletedFiles​(String origParentFolderPath)
        Gets all deleted files for the current user in this folder.
        Parameters:
        origParentFolderPath - path to original parent folder
        Returns:
        list of deleted files
      • getDeletedFiles

        List<RepositoryFile> getDeletedFiles​(String origParentFolderPath,
                                             String filter)
        Gets all deleted files for the current user in this folder.
        Parameters:
        origParentFolderPath - path to original parent folder
        filter - filter may be a full name or a partial name with one or more wildcard characters ("*"), or a disjunction (using the "|" character to represent logical OR) of these
        Returns:
        list of deleted files
      • getDeletedFiles

        List<RepositoryFile> getDeletedFiles()
        Gets all deleted files for the current user. This is the "recycle bin" view.
        Returns:
        list of deleted files
      • getAllDeletedFiles

        default List<RepositoryFile> getAllDeletedFiles()
        Gets all deleted files. This is the "recycle bin" view.
        Returns:
        list of deleted files
      • canUnlockFile

        boolean canUnlockFile​(Serializable fileId)
        Returns true if the current user can unlock the file. This might be a function of access control.
        Parameters:
        fileId - file id
        Returns:
        true if the current user can unlock the file
      • lockFile

        void lockFile​(Serializable fileId,
                      String message)
        Locks a file.
        Parameters:
        fileId - file id
        lock - message
      • unlockFile

        void unlockFile​(Serializable fileId)
        Unlocks a file.
        Parameters:
        fileId - file id
      • hasAccess

        boolean hasAccess​(String path,
                          EnumSet<RepositoryFilePermission> permissions)
        Returns true if user has all permissions given. Note that false is returned when the path does not exist.
        Parameters:
        path - path to file or folder
        permissions - permissions to check
        Returns:
        true if user has all permissions given
      • getEffectiveAces

        List<RepositoryFileAce> getEffectiveAces​(Serializable fileId)
        Returns the list of access control entries (ACEs) that will be used to make an access control decision. This method is equivalent to getEffectiveAces(fileId, false).
        Parameters:
        fileId - file id
        Returns:
        list of ACEs
      • getEffectiveAces

        List<RepositoryFileAce> getEffectiveAces​(Serializable fileId,
                                                 boolean forceEntriesInheriting)
        Returns the list of access control entries (ACEs) that will be used to make an access control decision. This method is equivalent to getEffectiveAces(get_parent_id(fileId)). Note that get_parent_id is not a real method.
        Parameters:
        fileId - file id
        forceEntriesInheriting - true to treat ACL as if isEntriesInheriting was true; this avoids having the caller fetch the parent of ACL belonging to file with fileId; no change is persisted to the ACL
        Returns:
        list of ACEs
      • getVersionSummary

        VersionSummary getVersionSummary​(Serializable fileId,
                                         Serializable versionId)
        Returns a version summary for the given file id and version id.
        Parameters:
        fileId - file id
        versionId - version id (if null, returns the last version)
        Returns:
        version summary
      • getVersionSummaries

        List<VersionSummary> getVersionSummaries​(Serializable fileId)
        Returns a list of version summary instances. The first version in the list is the root version. The last version in the list is the base version. Branching and merging are not supported so this is a simple list.
        Parameters:
        fileId - file id
        Returns:
        list of version summaries (never null)
      • deleteFileAtVersion

        void deleteFileAtVersion​(Serializable fileId,
                                 Serializable versionId)
        Permanently deletes a specific version of a file. The version is removed from the version history of the given file.
        Parameters:
        fileId - file id
        versionId - version id (MUST not be null)
      • restoreFileAtVersion

        void restoreFileAtVersion​(Serializable fileId,
                                  Serializable versionId,
                                  String versionMessage)
        Makes a file, as it was at the given version, the latest version. Result should be the same as if the user had called updateFile(RepositoryFile, IRepositoryFileData, String) with a file and data that matched the state of the file and data at the given version.
        Parameters:
        fileId - file id
        versionId - version id
        versionMessage - optional version comment
      • getReferrers

        List<RepositoryFile> getReferrers​(Serializable fileId)
        Get a list of RepositoryFiles that reference the RepositoryFile identified by fileId.
        Parameters:
        fileId - file id
        Returns:
        list of repository files that reference the fileId repository file
      • setFileMetadata

        void setFileMetadata​(Serializable fileId,
                             Map<String,​Serializable> metadataMap)
        Sets a metadata object for the given fileid
        Parameters:
        fileId - file id
        metadataMap - Map of properties to apply to this file.
      • getFileMetadata

        Map<String,​Serializable> getFileMetadata​(Serializable fileId)
        Gets a metadata for the given fileid
        Parameters:
        fileId - file id
        Returns:
        Map of all the metadata for this file
      • getReservedChars

        List<Character> getReservedChars()
        Returns a list of characters which cannot be used in file/folder names. These characters must be escaped using percent-encoding. Callers may safely cache this value. Note that it is the responsibility of the implementation to guard against illegal permutations of non-reserved characters.
        A percent-encoded octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing that octet's numeric value. For example, "%20" is the percent-encoding for the binary octet "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space character (SP).
        Returns:
        list of reserved characters
      • getAvailableLocalesForFileByPath

        List<Locale> getAvailableLocalesForFileByPath​(String relPath)
      • getLocalePropertiesForFileByPath

        Properties getLocalePropertiesForFileByPath​(String relPath,
                                                    String locale)
      • setLocalePropertiesForFileByPath

        void setLocalePropertiesForFileByPath​(String relPath,
                                              String locale,
                                              Properties properties)
      • deleteLocalePropertiesForFile

        void deleteLocalePropertiesForFile​(RepositoryFile repositoryFile,
                                           String locale)