Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * This program is free software; you can redistribute it and/or modify it under the 
   * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software 
   * Foundation.
   *
   * You should have received a copy of the GNU Lesser General Public License along with this 
   * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html 
   * or from the Free Software Foundation, Inc., 
   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * Copyright 2012-2013 Pentaho Corporation.  All rights reserved.
  *
  */
 package org.pentaho.platform.api.repository2.unified;
 
 import java.util.*;
 
Entry point into the unified repository. The finest grained object that can be read and written to this repository is a RepositoryFile.

Author(s):
mlowery
 
 public interface IUnifiedRepository {
   public static final String SYSTEM_FOLDER = "system_folder"//$NON-NLS-1$
 
  
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
 
   RepositoryFile getFile(final String path);

  
Gets a tree rooted at path.

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
 
   RepositoryFileTree getTree(final String pathfinal int depthfinal String filterfinal boolean showHidden);

  
Gets file as it was at the given version.

Parameters:
fileId file id
versionId version id
Returns:
file at version
 
   RepositoryFile getFileAtVersion(final Serializable fileIdfinal Serializable versionId);

  
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
 
   RepositoryFile getFileById(final Serializable fileId);

  
Same as getFile(java.lang.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
 
   RepositoryFile getFile(final String pathfinal boolean loadLocaleMaps);

  
Same as getFile(java.lang.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
 
   RepositoryFile getFileById(final Serializable fileIdfinal boolean loadLocaleMaps);

  
Like getFile(java.lang.String,boolean) except that the maps which are pulled back are slimmed down to only contain the localized strings

Parameters:
path java.lang.String of the path to the file
locale org.pentaho.platform.api.locale.IPentahoLocale which the user wishes to have contained in the map
Returns:
RepositoryFile
  RepositoryFile getFile(final String pathfinal IPentahoLocale locale);

  
Same as getFile(java.lang.String,org.pentaho.platform.api.locale.IPentahoLocale) except that the java.io.Serializable file id is required

Parameters:
fileId java.io.Serializable file Id of the file
locale org.pentaho.platform.api.locale.IPentahoLocale which the user wishes to have contained in the map
Returns:
RepositoryFile
  RepositoryFile getFileById(final Serializable fileIdfinal IPentahoLocale locale);

  
Retrieves a file at its given version

Parameters:
path java.lang.String full path to file
loadLocaleMaps boolean - to determine whether to load the locale map
locale org.pentaho.platform.api.locale.IPentahoLocale locale to retrieve for RepositoryFile
Returns:
RepositoryFile
  RepositoryFile getFile(final String pathfinal boolean loadLocaleMapsfinal IPentahoLocale locale);

  
Retrieves a file at its given version by its id

Parameters:
fileId java.io.Serializable file id
loadLocaleMaps boolean - to determine whether to load the locale map
locale org.pentaho.platform.api.locale.IPentahoLocale locale to retrieve for RepositoryFile
Returns:
RepositoryFile
  RepositoryFile getFileById(final Serializable fileIdfinal boolean loadLocaleMapsfinal IPentahoLocale locale);

  
Gets data at base version for read.

Parameters:
fileId file id
dataClass class that implements IRepositoryFileData
Returns:
data
  <T extends IRepositoryFileData> T getDataForRead(final Serializable fileIdfinal Class<T> dataClass);

  
Gets data at given version for read.

Parameters:
fileId file id
versionId version id
dataClass class that implements IRepositoryFileData
Returns:
data
  <T extends IRepositoryFileData> T getDataAtVersionForRead(final Serializable fileIdfinal Serializable versionId,
      final Class<T> dataClass);

  
Gets data at base version for execute.

Parameters:
fileId file id
dataClass class that implements IRepositoryFileData
Returns:
data
  <T extends IRepositoryFileData> T getDataForExecute(final Serializable fileIdfinal Class<T> dataClass);

  
Gets data at given version for read.

Parameters:
fileId file id
versionId version id
dataClass class that implements IRepositoryFileData
Returns:
data
  <T extends IRepositoryFileData> T getDataAtVersionForExecute(final Serializable fileIdfinal Serializable versionId,
      final Class<T> dataClass);

  
Gets the data for multiple RepositoryFiles for read. Each RepositoryFile may or may not contain a version number. If a version number is omitted it is assumed the latest data for the RepositoryFile is being requested.

Parameters:
<T> Type of IRepositoryFileData
files Repository files to fetch data for. Only RepositoryFile.getId() and RepositoryFile.getVersionId() are used to identify IRepositoryFileData objects to return.
dataClass class that implements IRepositoryFileData
Returns:
data
      final Class<T> dataClass);

  
Gets the data for multiple RepositoryFiles for execute. Each RepositoryFile may or may not contain a version number. If a version number is omitted it is assumed the latest data for the RepositoryFile is being requested.

Parameters:
<T> Type of IRepositoryFileData
files Repository files to fetch data for. Only RepositoryFile.getId() and RepositoryFile.getVersionId() are used to identify IRepositoryFileData objects to return.
dataClass class that implements IRepositoryFileData
Returns:
data
      final Class<T> dataClass);

  
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
  RepositoryFile createFile(final Serializable parentFolderIdfinal RepositoryFile file,
      final IRepositoryFileData datafinal 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
  RepositoryFile createFile(final Serializable parentFolderIdfinal RepositoryFile file,
      final IRepositoryFileData datafinal RepositoryFileAcl aclfinal String versionMessage);

  
Creates a folder.

Parameters:
parentFolderId 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
  RepositoryFile createFolder(final Serializable parentFolderIdfinal RepositoryFile filefinal 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
  RepositoryFile createFolder(final Serializable parentFolderIdfinal RepositoryFile file,
      final RepositoryFileAcl aclfinal 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)
  RepositoryFile updateFolder(final RepositoryFile folderfinal String versionMessage);
  
  
Returns the children of this folder.

Parameters:
folderId id of folder whose children to fetch
Returns:
list of children (never null)
  List<RepositoryFilegetChildren(final Serializable folderId);

  
Returns the children of this folder that match the specified filter.

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)
  List<RepositoryFilegetChildren(final Serializable folderIdfinal String filter);

  
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)
  RepositoryFile updateFile(final RepositoryFile filefinal IRepositoryFileData datafinal String versionMessage);

  
Deletes a file.

Parameters:
fileId file id
permanent if true, once file is deleted, it cannot be undeleted
versionMessage optional version comment
  void deleteFile(final Serializable fileIdfinal boolean permanentfinal String versionMessage);

  
Deletes a file in a recoverable manner.

Parameters:
fileId file id
versionMessage optional version comment
  void deleteFile(final Serializable fileIdfinal 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
  void moveFile(final Serializable fileIdfinal String destAbsPathfinal 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
  void copyFile(final Serializable fileIdfinal String destAbsPathfinal String versionMessage);
  // ~ Undelete methods ================================================================================================

  
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
  void undeleteFile(final Serializable fileIdfinal String versionMessage);

  
Gets all deleted files for the current user in this folder.

Parameters:
origParentFolderPath path to original parent folder
Returns:
list of deleted files
  List<RepositoryFilegetDeletedFiles(final String origParentFolderPath);

  
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
  List<RepositoryFilegetDeletedFiles(final String origParentFolderPathfinal String filter);

  
Gets all deleted files for the current user. This is the "recycle bin" view.

Returns:
list of deleted files
  // ~ Lock methods ====================================================================================================

  
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
  boolean canUnlockFile(final Serializable fileId);

  
Locks a file.

Parameters:
fileId file id
lock message
  void lockFile(final Serializable fileIdfinal String message);

  
Unlocks a file.

Parameters:
fileId file id
  void unlockFile(final Serializable fileId);
  // ~ Access read/write methods =======================================================================================

  
Returns ACL for file.

Parameters:
fileId file id
Returns:
access control list
  RepositoryFileAcl getAcl(final Serializable fileId);

  
Updates an ACL.

Parameters:
acl ACL to set; must have non-null id
Returns:
updated ACL as it would be if calling getAcl(java.io.Serializable)
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
  boolean hasAccess(final String pathfinal EnumSet<RepositoryFilePermissionpermissions);

  
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
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
  List<RepositoryFileAcegetEffectiveAces(final Serializable fileIdfinal boolean forceEntriesInheriting);
  // ~ Version methods =================================================================================================

  
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
Returns a version summary for every RepositoryFile provided. Each RepositoryFile may or may not contain a version number. If a version number is omitted it is assumed the latest version for the RepositoryFile is being requested.

Parameters:
files Repository files to fetch version summaries for. Only RepositoryFile.getId() and RepositoryFile.getVersionId() are used to identify VersionSummary objects to return.
Returns:
version summary for every file provided
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)
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)
  void deleteFileAtVersion(final Serializable fileIdfinal Serializable versionId);

  
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(org.pentaho.platform.api.repository2.unified.RepositoryFile,org.pentaho.platform.api.repository2.unified.IRepositoryFileData,java.lang.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
  void restoreFileAtVersion(final Serializable fileIdfinal Serializable versionIdfinal String versionMessage);

  
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
  // ~ Metadata methods =================================================================================================

  
Sets a metadata object for the given fileid

Parameters:
fileId file id
metadataMap Map of properties to apply to this file.
  void setFileMetadata(final Serializable fileIdfinal Map<StringSerializablemetadataMap);

  
Gets a metadata for the given fileid

Parameters:
fileId file id
Returns:
Map<String, Serializable> of all the metadata for this file
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
  Properties getLocalePropertiesForFileById(final Serializable fileIdfinal String locale);
  Properties getLocalePropertiesForFileByPath(final String relPathfinal String locale);
  Properties getLocalePropertiesForFile(final RepositoryFile repositoryFilefinal String locale);
  void setLocalePropertiesForFileById(final Serializable fileIdfinal String localefinal Properties properties);
  void setLocalePropertiesForFileByPath(final String relPathfinal String localefinal Properties properties);
  void setLocalePropertiesForFile(final RepositoryFile repositoryFilefinal String localefinal Properties properties);
  void deleteLocalePropertiesForFile(final RepositoryFile repositoryFilefinal String locale);
New to GrepCode? Check out our FAQ X