Search in sources :

Example 1 with RepositoryFileContentItem

use of org.pentaho.platform.repository2.unified.fileio.RepositoryFileContentItem in project pentaho-platform by pentaho.

the class XactionUtil method deleteContentItem.

static void deleteContentItem(IContentItem contentItem, IUnifiedRepository unifiedRepository) {
    if (contentItem instanceof RepositoryFileContentItem) {
        String path = contentItem.getPath();
        RepositoryFile repositoryFile = unifiedRepository.getFile(path);
        // repositoryFile can be null if we have not access or file does not exist
        if (repositoryFile != null) {
            unifiedRepository.deleteFile(repositoryFile.getId(), true, null);
        }
    } else if (contentItem instanceof FileContentItem) {
        // Files in the file system must not be deleted here
        String path = ((FileContentItem) contentItem).getFile().getName();
        logger.warn(Messages.getInstance().getString("XactionUtil.SKIP_REMOVING_OUTPUT_FILE", path));
    }
}
Also used : RepositoryFileContentItem(org.pentaho.platform.repository2.unified.fileio.RepositoryFileContentItem) FileContentItem(org.pentaho.platform.engine.core.output.FileContentItem) RepositoryFileContentItem(org.pentaho.platform.repository2.unified.fileio.RepositoryFileContentItem) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile)

Aggregations

RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)1 FileContentItem (org.pentaho.platform.engine.core.output.FileContentItem)1 RepositoryFileContentItem (org.pentaho.platform.repository2.unified.fileio.RepositoryFileContentItem)1