@RolesAllowed("user") public void removeUnusedFiles() { RepositoryTask task = new RepositoryTask(sql); // get ids for any objects marked as deleted List<Long> files = task.getFileIds(); List<Long> pixels = task.getPixelIds(); List<Long> thumbs = task.getThumbnailIds(); // cleanup any files if (files != null && files.size() > 0) { log.info("Removing files: " + files); fileService.removeFiles(files); } // cleanup any pixels if (pixels != null && pixels.size() > 0) { log.info("Removing pixels: " + pixels); pixelsService.removePixels(pixels); } // cleanup any thumbnails if (thumbs != null && thumbs.size() > 0) { log.info("Removing thumbnails: " + thumbs); thumbnailService.removeThumbnails(thumbs); } }
ioService.removeThumbnails( Arrays.asList(new Long[] { thumbnailMetadata.getId() }));