Search in sources :

Example 1 with ExportManifestFormatException

use of org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifestFormatException in project pentaho-platform by pentaho.

the class RepositoryFileImportFileHandler method createFolderJustInTime.

public RepositoryFile createFolderJustInTime(String folderPath, String manifestKey) throws PlatformImportException, DomainIdNullException, DomainAlreadyExistsException, DomainStorageException, IOException {
    // The file doesn't exist and it is a folder. Create folder.
    getLogger().trace("Creating implied folder [" + folderPath + "]");
    final Serializable parentId = getParentId(folderPath);
    Assert.notNull(parentId);
    boolean isHidden;
    if (getImportSession().isFileHidden(manifestKey) == null) {
        isHidden = false;
    } else {
        isHidden = getImportSession().isFileHidden(manifestKey);
    }
    RepositoryFile.Builder builder = new RepositoryFile.Builder(RepositoryFilenameUtils.getName(folderPath)).path(RepositoryFilenameUtils.getPath(folderPath)).folder(true).hidden(isHidden);
    RepositoryFile repoFile = builder.build();
    RepositoryFileAcl repoAcl = getImportSession().processAclForFile(manifestKey);
    if (repoAcl != null) {
        repoFile = repository.createFolder(parentId, repoFile, repoAcl, null);
        RepositoryFileAcl repositoryFileAcl = null;
        try {
            repositoryFileAcl = getImportSession().getManifest().getExportManifestEntity(manifestKey).getRepositoryFileAcl();
        } catch (NullPointerException e) {
        // If npe then manifest entry is not defined which is likely so just ignore
        } catch (ExportManifestFormatException e) {
        // Same goes here
        }
        updateAcl(true, repoFile, repositoryFileAcl);
    } else {
        repoFile = repository.createFolder(parentId, repoFile, null);
    }
    getImportSession().getFoldersCreatedImplicitly().add(folderPath);
    return repoFile;
}
Also used : Serializable(java.io.Serializable) ExportManifestFormatException(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifestFormatException) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) RepositoryFileAcl(org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)

Aggregations

Serializable (java.io.Serializable)1 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1 RepositoryFileAcl (org.pentaho.platform.api.repository2.unified.RepositoryFileAcl)1 ExportManifestFormatException (org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifestFormatException)1