public class FileService extends Object
Modifier and Type | Class and Description |
---|---|
class |
FileService.DownloadFileWrapper |
class |
FileService.RepositoryFileToStreamWrapper |
Constructor and Description |
---|
FileService() |
Modifier and Type | Method and Description |
---|---|
int |
copy(InputStream input,
OutputStream output) |
void |
createFile(String charsetName,
String pathId,
InputStream fileContents)
Creates a new file with the provided contents at a given path
|
boolean |
doCanAdminister()
Checks whether the current user can administer the platform.
|
void |
doCopyFiles(String pathId,
Integer mode,
String params)
Copy files to a new location
|
boolean |
doCreateDir(String pathId)
Creates a new folder with the specified name
|
void |
doDeleteFiles(String params)
Moves the list of files to the user's trash folder
Move a list of files to the user's trash folder, the list should be comma separated.
|
void |
doDeleteFilesPermanent(String params)
Permanently deletes the selected list of files from the repository
Permanently deletes a comma separated list of files without sending them to the trash folder
|
void |
doDeleteLocale(String pathId,
String locale)
Delete the locale for the selected file and locale
|
String |
doGetCanAccess(String pathId,
String permissions)
Check whether the current user has specific permission on the selected repository file
|
List<Setting> |
doGetCanAccessList(String pathId,
String permissions) |
String |
doGetCanCreate()
Gets the permission for whether or not a user can create files
|
List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> |
doGetChildren(String pathId,
String filter,
Boolean showHidden,
Boolean includeAcls) |
org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto |
doGetContentCreator(String pathId)
Gets the content creator of the specified file
|
List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> |
doGetDeletedFiles()
Get deleted files
|
org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto |
doGetFileAcl(String pathId)
Retrieves the acls of the selected repository file
|
FileService.RepositoryFileToStreamWrapper |
doGetFileAsInline(String pathId)
Retrieves the file from the repository as inline.
|
List<org.pentaho.platform.repository2.unified.webservices.LocaleMapDto> |
doGetFileLocales(String pathId)
Retrieves the list of locale map for the selected repository file.
|
FileService.RepositoryFileToStreamWrapper |
doGetFileOrDir(String pathId)
Takes a pathId and returns a response object with the output stream based on the file located at the pathID
|
FileService.DownloadFileWrapper |
doGetFileOrDirAsDownload(String userAgent,
String pathId,
String strWithManifest) |
List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> |
doGetGeneratedContent(String pathId)
Retrieve the executed contents for a selected repository file
|
List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> |
doGetGeneratedContent(String pathId,
String user)
Retrieve the executed contents for a selected repository file and a given user
|
List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> |
doGetLocaleProperties(String pathId,
String locale)
Retrieve the list of locale properties for a given locale
|
List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> |
doGetMetadata(String pathId)
Get metadata for a file by path id
|
List<Setting> |
doGetPathsAccessList(StringListWrapper pathsWrapper) |
org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto |
doGetProperties(String pathId)
Retrieves the properties of a selected repository file
|
StringBuffer |
doGetReservedCharactersDisplay() |
StringBuffer |
doGetReservedChars() |
org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto |
doGetRootProperties()
Retrieves the properties of the root directory
|
org.pentaho.platform.repository2.unified.webservices.RepositoryFileTreeDto |
doGetTree(String pathId,
Integer depth,
String filter,
Boolean showHidden,
Boolean includeAcls) |
void |
doMoveFiles(String destPathId,
String params)
Moves a list of files from its current location to another.
|
boolean |
doRename(String pathId,
String newName)
Rename the name of the selected file
|
void |
doRestoreFiles(String params)
Restores a list of files from the user's trash folder
Restores a list of files from the user's trash folder to their previous locations.
|
void |
doSetContentCreator(String pathId,
org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto contentCreator)
Store content creator of the selected repository file
|
void |
doSetLocaleProperties(String pathId,
String locale,
List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> properties)
Set the list of locale properties for a given locale
|
void |
doSetMetadata(String pathId,
List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> metadata)
Set the metadata on a file
|
org.pentaho.platform.api.repository2.unified.IRepositoryFileData |
getData(org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile) |
org.pentaho.platform.api.engine.IAuthorizationPolicy |
getPolicy() |
org.pentaho.platform.api.repository2.unified.IUnifiedRepository |
getRepository() |
org.pentaho.platform.repository2.unified.fileio.RepositoryFileInputStream |
getRepositoryFileInputStream(org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile) |
org.pentaho.platform.repository2.unified.fileio.RepositoryFileOutputStream |
getRepositoryFileOutputStream(String path) |
javax.ws.rs.core.StreamingOutput |
getStreamingOutput(InputStream is) |
org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto |
getStringKeyStringValueDto(String key,
String value) |
org.pentaho.platform.repository.RepositoryDownloadWhitelist |
getWhitelist() |
String |
idToPath(String pathId) |
boolean |
isPath(String pathId) |
boolean |
isPathValid(String path) |
boolean |
isShowingTitle(org.pentaho.platform.api.repository2.unified.RepositoryRequest repositoryRequest) |
void |
setFileAcls(String pathId,
org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto acl)
Save the acls of the selected file to the repository
This method is used to update and save the acls of the selected file to the repository
|
void |
sortByLocaleTitle(Collator collator,
List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> repositoryFileDtoList) |
void |
sortByLocaleTitle(Collator collator,
org.pentaho.platform.repository2.unified.webservices.RepositoryFileTreeDto tree) |
FileService.DownloadFileWrapper |
systemBackup(String userAgent) |
void |
systemRestore(InputStream fileUpload,
String overwriteFile) |
org.pentaho.platform.api.repository2.unified.RepositoryFile |
toFile(org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto repositoryFileDto) |
public FileService.DownloadFileWrapper systemBackup(String userAgent) throws IOException, ExportException
IOException
ExportException
public void systemRestore(InputStream fileUpload, String overwriteFile) throws PlatformImportException, SecurityException
public void doDeleteFiles(String params) throws Exception
params
- Comma separated list of the files to be deletedException
- containing the string, "SystemResource.GENERAL_ERROR"public void doDeleteFilesPermanent(String params) throws Exception
params
- Comma separated list of the files to be deletedException
public void doDeleteLocale(String pathId, String locale) throws Exception
pathId
- Colon separated path for the repository filelocale
- The locale to be deletedException
- containing the string, "SystemResource.GENERAL_ERROR"public List<Setting> doGetPathsAccessList(StringListWrapper pathsWrapper)
public void createFile(String charsetName, String pathId, InputStream fileContents) throws Exception
pathId
- (colon separated path for the repository file)fileContents
- (content of the file)IOException
Exception
public void doMoveFiles(String destPathId, String params) throws FileNotFoundException
destPathId
- colon separated path for the repository file
:path:to:file:id
params
- comma separated list of files to be moved
path1,path2,...
FileNotFoundException
public void doRestoreFiles(String params) throws InternalError
params
- Comma separated list of files to be restoredException
- containing the string, "SystemResource.GENERAL_ERROR"InternalError
public FileService.DownloadFileWrapper doGetFileOrDirAsDownload(String userAgent, String pathId, String strWithManifest) throws Throwable
Throwable
public FileService.RepositoryFileToStreamWrapper doGetFileAsInline(String pathId) throws FileNotFoundException
pathId
- (colon separated path for the repository file)FileNotFoundException
public List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> doGetLocaleProperties(String pathId, String locale)
pathId
- (colon separated path for the repository file)locale
- public void doSetLocaleProperties(String pathId, String locale, List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> properties) throws Exception
pathId
- locale
- properties
- Exception
public void doCopyFiles(String pathId, Integer mode, String params)
pathId
- mode
- params
- public FileService.RepositoryFileToStreamWrapper doGetFileOrDir(String pathId) throws FileNotFoundException
pathId
- pathId to the fileFileNotFoundException,
- IllegalArgumentExceptionFileNotFoundException
public org.pentaho.platform.api.repository2.unified.IRepositoryFileData getData(org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile)
public void setFileAcls(String pathId, org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto acl) throws FileNotFoundException
pathId
- @param pathId colon separated path for the repository file
:path:to:file:id
acl
- Acl of the repository file RepositoryFileAclDto
FileNotFoundException
public String doGetCanAccess(String pathId, String permissions)
pathId
- permissions
- public StringBuffer doGetReservedChars()
public StringBuffer doGetReservedCharactersDisplay()
public org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto doGetRootProperties()
RepositoryFileDto
for the root directorypublic org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto doGetProperties(String pathId) throws FileNotFoundException
pathId
- @param pathId colon separated path for the repository file
:path:to:file:id
RepositoryFileDto
FileNotFoundException
public String doGetCanCreate()
public org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto doGetContentCreator(String pathId) throws FileNotFoundException
pathId
- FileNotFoundException
public List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> doGetDeletedFiles()
public List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> doGetMetadata(String pathId) throws FileNotFoundException
pathId
- FileNotFoundException
public void doSetMetadata(String pathId, List<org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto> metadata) throws GeneralSecurityException
pathId
- metadata
- GeneralSecurityException
public org.pentaho.platform.api.repository2.unified.RepositoryFile toFile(org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto repositoryFileDto)
public org.pentaho.platform.repository.RepositoryDownloadWhitelist getWhitelist()
public boolean isPathValid(String path)
public boolean isPath(String pathId)
public org.pentaho.platform.api.engine.IAuthorizationPolicy getPolicy()
public void doSetContentCreator(String pathId, org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto contentCreator) throws FileNotFoundException
pathId
- colon separated path for the repository file
:path:to:file:id
contentCreator
- repository file
<repositoryFileDto> <createdDate>1402911997019</createdDate> <fileSize>3461</fileSize> <folder>false</folder> <hidden>false</hidden> <id>ff11ac89-7eda-4c03-aab1-e27f9048fd38</id> <lastModifiedDate>1406647160536</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries> <locked>false</locked> <name>myFile.prpt</name></name> <originalParentFolderPath>/public/admin</originalParentFolderPath> <ownerType>-1</ownerType> <path>/public/admin/ff11ac89-7eda-4c03-aab1-e27f9048fd38</path> <title>myFile</title> <versionId>1.9</versionId> <versioned>true</versioned> </repositoryFileAclDto>
FileNotFoundException
public List<org.pentaho.platform.repository2.unified.webservices.LocaleMapDto> doGetFileLocales(String pathId) throws FileNotFoundException
pathId
- colon separated path for the repository file
:path:to:file:id
List
the list of locales
<localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries>
FileNotFoundException
public boolean doCanAdminister()
RepositoryReadAction
, RepositoryCreateAction
and
AdministerSecurityAction
boolean
public org.pentaho.platform.repository2.unified.webservices.RepositoryFileAclDto doGetFileAcl(String pathId)
pathId
- (colon separated path for the repository file) RepositoryFileAclDto
public org.pentaho.platform.repository2.unified.webservices.RepositoryFileTreeDto doGetTree(String pathId, Integer depth, String filter, Boolean showHidden, Boolean includeAcls)
public void sortByLocaleTitle(Collator collator, org.pentaho.platform.repository2.unified.webservices.RepositoryFileTreeDto tree)
public List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> doGetGeneratedContent(String pathId) throws FileNotFoundException
pathId
- the path for the file repositoryFileDto
FileNotFoundException
- if the file is not foundpublic List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> doGetGeneratedContent(String pathId, String user) throws FileNotFoundException
pathId
- the path for the fileuser
- the username for the generated content folder repositoryFileDto
FileNotFoundException
public boolean doRename(String pathId, String newName) throws Exception
pathId
- (colon separated path for the repository file)newName
- (New name of the file)Exception
public boolean doCreateDir(String pathId)
pathId
- The path from the root folder to the root node of the tree to return using colon characters in
place of / or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file
:path:to:file
public int copy(InputStream input, OutputStream output) throws IOException
IOException
public org.pentaho.platform.repository2.unified.fileio.RepositoryFileOutputStream getRepositoryFileOutputStream(String path)
public org.pentaho.platform.repository2.unified.fileio.RepositoryFileInputStream getRepositoryFileInputStream(org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile) throws FileNotFoundException
FileNotFoundException
public javax.ws.rs.core.StreamingOutput getStreamingOutput(InputStream is)
public org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto getStringKeyStringValueDto(String key, String value)
public org.pentaho.platform.api.repository2.unified.IUnifiedRepository getRepository()
public List<org.pentaho.platform.repository2.unified.webservices.RepositoryFileDto> doGetChildren(String pathId, String filter, Boolean showHidden, Boolean includeAcls)
public boolean isShowingTitle(org.pentaho.platform.api.repository2.unified.RepositoryRequest repositoryRequest)