Class RepositoryImportResource
- java.lang.Object
-
- org.pentaho.platform.web.http.api.resources.RepositoryImportResource
-
public class RepositoryImportResource extends Object
-
-
Constructor Summary
Constructors Constructor Description RepositoryImportResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
doPostImport(String importDir, InputStream fileUpload, String overwriteFile, String overwriteAclPermissions, String applyAclPermission, String retainOwnership, String charSet, String logLevel, com.sun.jersey.core.header.FormDataContentDisposition fileInfo, String fileNameOverride)
Attempts to import all files from the zip archive or single file.protected void
validateImportAccess(String importDir)
-
-
-
Method Detail
-
doPostImport
public javax.ws.rs.core.Response doPostImport(String importDir, InputStream fileUpload, String overwriteFile, String overwriteAclPermissions, String applyAclPermission, String retainOwnership, String charSet, String logLevel, com.sun.jersey.core.header.FormDataContentDisposition fileInfo, String fileNameOverride)
Attempts to import all files from the zip archive or single file. A log file is produced at the end of import.Example Request:
POST pentaho/api/repo/files/import
POST data:------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="importDir" /public ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="fileUpload"; filename="test.csv" Content-Type: application/vnd.ms-excel ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="overwriteFile" true ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="overwriteAclPermissions" true ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="applyAclPermissions" true ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="retainOwnership" true ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="charSet" UTF-8 ------WebKitFormBoundaryB9hzsGp4wR5SGAZD Content-Disposition: form-data; name="logLevel" INFO ------WebKitFormBoundaryd1z6iZhXyx12RYxV Content-Disposition: form-data; name="fileNameOverride" fileNameOverriden.csv ------WebKitFormBoundaryd1z6iZhXyx12RYxV--
- Parameters:
importDir
- JCR Directory to which the zip structure or single file will be uploaded to.fileUpload
- Input stream for the file.overwriteFile
- The flag indicates ability to overwrite existing file.overwriteAclPermissions
- The flag indicates ability to overwrite Acl permissions.applyAclPermissions
- The flag indicates ability to apply Acl permissions.retainOwnership
- The flag indicates ability to retain ownership.charSet
- The charset for imported file.logLevel
- The level of logging.fileNameOverride
- If present and the content represents a single file, this parameter contains the filename to use when storing the file in the repository. If not present, the fileInfo.getFileName will be used. Note that the later cannot reliably handle foreign character sets.- Returns:
- A jax-rs Response object with the appropriate header and body.
Example Response:
<html> <head> <title>Repository Import Log</title> </head> <body bgcolor="#FFFFFF" topmargin="6" leftmargin="6" style="font-family: arial,sans-serif; font-size: x-small"> <hr size="1" noshade> Log session start time Thu Feb 26 11:04:19 BRT 2015<br> <br> <table cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" width="100%"> <tr style="background: #336699; color: #FFFFFF; text-align: left"> <th>Import File</th> <th>Level</th> <th>Message</th> </tr> <td title="importFile">/public</td> <td title="Level">INFO</td> <td title="Message">Start Import Job</td> </tr> <td title="importFile">/public/fileNameOverriden.csv</td> <td title="Level">INFO</td> <td title="Message">Start File Import</td> </tr> <td title="importFile">/public/fileNameOverriden.csv</td> <td title="Level"><font color="#993300"><strong>WARN</strong></font></td> <td title="Message">fileNameOverriden.csv</td> </tr> <td title="importFile">/public</td> <td title="Level">INFO</td> <td title="Message">End Import Job</td> </tr> </table> <br> </body></html>
-
validateImportAccess
protected void validateImportAccess(String importDir) throws org.pentaho.platform.api.engine.PentahoAccessControlException
- Throws:
org.pentaho.platform.api.engine.PentahoAccessControlException
-
-