diff --git a/file-repository-core/pom.xml b/file-repository-core/pom.xml index 2089d3b1b86c9babc819bd5fcf9f5a43cdcd50bb..172d3568d62ec2be598141422a28cec1b7015be3 100644 --- a/file-repository-core/pom.xml +++ b/file-repository-core/pom.xml @@ -159,6 +159,19 @@ ${spring.data.version} + + org.springframework.data + spring-data-elasticsearch + 2.1.15.RELEASE + provided + + + org.elasticsearch + elasticsearch + + + + org.hibernate diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/migration/RepositoryUpgrade20180920.java b/file-repository-core/src/main/java/org/genesys/filerepository/migration/RepositoryUpgrade20180920.java index c3ecf02e1e8fa19b05f2d981d51aeb231624c322..50ac556c8ebf84390f1f407b68a203e147d4a288 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/migration/RepositoryUpgrade20180920.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/migration/RepositoryUpgrade20180920.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Global Crop Diversity Trust + * Copyright 2020 Global Crop Diversity Trust * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory; /** * Creates {@link RepositoryFolder} entries and their parents - Links all - * {@link RepositoryFile} to their parent folders + * {@link RepositoryFile} to their parent folders. * * @author Matija Obreza */ @@ -65,6 +65,11 @@ public class RepositoryUpgrade20180920 { @Autowired private JPAQueryFactory jpaQueryFactory; + /** + * Do upgrade. + * + * @throws Exception the exception + */ public void doUpgrade() throws Exception { TransactionTemplate tmpl = new TransactionTemplate(txManager); tmpl.execute(new TransactionCallbackWithoutResult() { diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/ImageGalleryPersistence.java b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/ImageGalleryPersistence.java index 17c4aa298df86ab5fbbf3b2242e6bbded30bc457..fa05d5103d4e9b4c84c38a4eb1c74af1085f2ae1 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/ImageGalleryPersistence.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/ImageGalleryPersistence.java @@ -31,7 +31,7 @@ public interface ImageGalleryPersistence extends JpaRepository findByFolder(RepositoryFolder folder); diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryFilePersistence.java b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryFilePersistence.java index c000d95b7fa3fc0b322cf32c046b5494851d1194..42e76318828d86e7a0f0db1a00c434922436b88d 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryFilePersistence.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryFilePersistence.java @@ -26,7 +26,6 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.stereotype.Repository; -// TODO: Auto-generated Javadoc /** * The Interface RepositoryFilePersistence. */ diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryImagePersistence.java b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryImagePersistence.java index 7d1c1a329edec3afd2b03f533b608d888a0c8702..bd71dee80b1e84ad01d8f5988876b5c127d57c90 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryImagePersistence.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/persistence/RepositoryImagePersistence.java @@ -26,7 +26,6 @@ import org.springframework.data.domain.Sort; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.stereotype.Repository; -// TODO: Auto-generated Javadoc /** * The Interface RepositoryImagePersistence. */ @@ -51,9 +50,10 @@ public interface RepositoryImagePersistence extends RepositoryPersistence findByFolder(RepositoryFolder folder, final Sort sort); diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/ImageGalleryService.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/ImageGalleryService.java index 3a453a0785661ba2847600ba6d7d53457ad15c43..15c7d2fdee192e9146be5c93ed49242379a21801 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/ImageGalleryService.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/ImageGalleryService.java @@ -107,9 +107,9 @@ public interface ImageGalleryService { ImageGallery saveImageOrder(ImageGallery imageGallery); /** - * Ensure that thumbnails are created for pre-configured thumbnail sizes - * - * @param imageGallery + * Ensure that thumbnails are created for pre-configured thumbnail sizes. + * + * @param imageGallery the image gallery */ void ensureThumbnails(ImageGallery imageGallery); @@ -135,7 +135,7 @@ public interface ImageGalleryService { /** * List image galleries at repository path starting with prefix. * - * @param prefix the prefix + * @param root the root * @param pageable the pageable * @return paginated image gallery data * @throws InvalidRepositoryPathException if path is not a valid repository path diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java index e9bcd3be60fa7e9c69b36701308a65675b74439b..3583d8f7617e88b71d6d422e4c7e7ef5366069c6 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/RepositoryService.java @@ -107,8 +107,8 @@ public interface RepositoryService { * @param path the path * @param filename the filename * @return the file - * @throws InvalidRepositoryPathException if path is not a valid repository path * @throws NoSuchRepositoryFileException the no such repository file exception + * @throws InvalidRepositoryPathException if path is not a valid repository path */ RepositoryFile getFile(Path path, String filename) throws NoSuchRepositoryFileException, InvalidRepositoryPathException; @@ -125,9 +125,9 @@ public interface RepositoryService { * List all files at the specified repository path. * * @param folderPath the folder path + * @param sort the sort * @return the files * @throws InvalidRepositoryPathException if path is not a valid repository path - * @throws NoSuchRepositoryFileException */ List getFiles(Path folderPath, Sort sort) throws InvalidRepositoryPathException; @@ -144,9 +144,10 @@ public interface RepositoryService { /** * Stream file info at the specified repository path. * - * @param repositoryPath the repository path + * @param root the root + * @param sort the sort * @return the files - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ Stream streamFiles(Path root, Sort sort) throws InvalidRepositoryPathException; @@ -202,7 +203,7 @@ public interface RepositoryService { * Move the file to a different repository path. * * @param repositoryFile the repository file - * @param newPath the new path + * @param target the target * @return the repository file * @throws NoSuchRepositoryFileException the no such repository file exception * @throws InvalidRepositoryPathException if path is not a valid repository path @@ -225,6 +226,7 @@ public interface RepositoryService { * List all {@link RepositoryImage} entries at specified path. * * @param path the path + * @param sort the sort * @return the list */ List listImages(Path path, Sort sort); @@ -233,7 +235,7 @@ public interface RepositoryService { * List all paths within the root Path, including the root folder itself if it * exists. * - * @param prefix the prefix + * @param root the root * @return the list * @throws InvalidRepositoryPathException if path is not a valid repository path */ @@ -261,15 +263,15 @@ public interface RepositoryService { RepositoryImage removeImage(RepositoryImage repositoryImage) throws NoSuchRepositoryFileException, IOException; /** - * Get folder by UUID - * + * Get folder by UUID. + * * @param uuid folder UUID * @return the folder */ RepositoryFolder getFolder(UUID uuid); /** - * Gets the folder by path + * Gets the folder by path. * * @param folderPath the folder path * @return the folder @@ -282,7 +284,8 @@ public interface RepositoryService { * * @param folder the folder * @return the updated repository folder - * @throws NoSuchRepositoryFolderException + * @throws NoSuchRepositoryFolderException the no such repository folder + * exception */ RepositoryFolder updateFolder(RepositoryFolder folder) throws NoSuchRepositoryFolderException; @@ -308,27 +311,27 @@ public interface RepositoryService { /** * Register a folder at specified path. Creates a new record if path is not * found. - * + * * @param path the folder path * @return a {@link RepositoryFolder} - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ RepositoryFolder ensureFolder(Path path) throws InvalidRepositoryPathException; /** - * Ensure folder exists with specified ACL parent object - * + * Ensure folder exists with specified ACL parent object. + * * @param path the folder path in repository * @param aclParentObject business entity "owning" the folder - * @return - * @throws InvalidRepositoryPathException + * @return the repository folder + * @throws InvalidRepositoryPathException the invalid repository path exception */ RepositoryFolder ensureFolder(Path path, AclAwareModel aclParentObject) throws InvalidRepositoryPathException; /** * Delete an empty folder (no children, no files). * - * @param string repository path + * @param path the path * @return the deleted repository folder * @throws FolderNotEmptyException if folder contains sub-folders or files * @throws InvalidRepositoryPathException if path is not a valid repository path @@ -336,10 +339,11 @@ public interface RepositoryService { RepositoryFolder deleteFolder(Path path) throws FolderNotEmptyException, InvalidRepositoryPathException; /** - * Get subfolders of root - * - * @param root - * @return + * Get subfolders of root. + * + * @param root the root + * @param sort the sort + * @return the folders * @throws InvalidRepositoryPathException if path is not a valid repository path */ List getFolders(Path root, Sort sort) throws InvalidRepositoryPathException; diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractImageGalleryAspects.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractImageGalleryAspects.java index 2894d5c4d60f1c7c129836b00439f735cd4d38c7..9f7cab7d81ac0a5afd5aef7f3058bf3c8c1cc6f1 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractImageGalleryAspects.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractImageGalleryAspects.java @@ -65,7 +65,7 @@ public abstract class AbstractImageGalleryAspects { * Adds the image to gallery. * * @param repositoryImage the repository image - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ protected abstract void addImageToGallery(RepositoryImage repositoryImage) throws InvalidRepositoryPathException; @@ -125,7 +125,7 @@ public abstract class AbstractImageGalleryAspects { * Removes the image from gallery. * * @param repositoryImage the repository image - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ protected abstract void removeImageFromGallery(RepositoryImage repositoryImage) throws InvalidRepositoryPathException; } \ No newline at end of file diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractRepositoryFolderAspects.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractRepositoryFolderAspects.java index 18cd00be78331b1059002a4626edb528008b5fea..c2b025a56b647d587e50135559f40d304da2ae2d 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractRepositoryFolderAspects.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/AbstractRepositoryFolderAspects.java @@ -112,6 +112,7 @@ public abstract class AbstractRepositoryFolderAspects { * On remove folder. * * @param repositoryFolder the repository folder + * @throws FileRepositoryException the file repository exception */ protected abstract void onRemoveFolder(RepositoryFolder repositoryFolder) throws FileRepositoryException; @@ -119,6 +120,7 @@ public abstract class AbstractRepositoryFolderAspects { * On add folder. * * @param repositoryFolder the repository folder + * @throws FileRepositoryException the file repository exception */ protected abstract void onSaveFolder(RepositoryFolder repositoryFolder) throws FileRepositoryException; } \ No newline at end of file diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/ImageGalleryAspectsImpl.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/ImageGalleryAspectsImpl.java index ca65f6b9558696e8f67ab4fd0810f93723d68b20..c41dd12ed4fdc70fa6fe1cdee3eeff710e17a783 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/ImageGalleryAspectsImpl.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/aspect/ImageGalleryAspectsImpl.java @@ -76,7 +76,7 @@ public class ImageGalleryAspectsImpl extends AbstractImageGalleryAspects impleme * add it to the gallery if it exists. * * @param repositoryImage the repository image - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ @Override public void addImageToGallery(final RepositoryImage repositoryImage) throws InvalidRepositoryPathException { @@ -112,7 +112,7 @@ public class ImageGalleryAspectsImpl extends AbstractImageGalleryAspects impleme * Check if image is part of a gallery at the specified path and remove it. * * @param repositoryImage the repository image - * @throws InvalidRepositoryPathException + * @throws InvalidRepositoryPathException the invalid repository path exception */ @Override public void removeImageFromGallery(final RepositoryImage repositoryImage) throws InvalidRepositoryPathException { diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/FilesystemStorageServiceImpl.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/FilesystemStorageServiceImpl.java index 206b5edb1b5fcc132da1c44e9dbf15236aa32620..5d20bc1b2b528fbfb9eda5660b039c2b13d3019b 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/FilesystemStorageServiceImpl.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/FilesystemStorageServiceImpl.java @@ -116,7 +116,7 @@ public class FilesystemStorageServiceImpl implements InitializingBean, BytesStor } /** - * Gets the path where subPath a sub-folder of {@link #repoDir} + * Gets the path where subPath a sub-folder of {@link #repoDir}. * * @param subPath the normal path * @return the dest path diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/ImageGalleryServiceImpl.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/ImageGalleryServiceImpl.java index 1bb6e23b28968214e0713a9413dcddd447fbaa33..cbf8503e626e1444f50bf5bb389f74e2f7e69827 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/ImageGalleryServiceImpl.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/ImageGalleryServiceImpl.java @@ -57,7 +57,7 @@ import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; /** - * Image Gallery service + * Image Gallery service. */ @Service @Transactional(readOnly = true) @@ -437,6 +437,11 @@ public class ImageGalleryServiceImpl implements ImageGalleryService { return new PageImpl<>(content, pageable, total); } + /** + * Sets the thumbnail sizes. + * + * @param thumbnailSizes the new thumbnail sizes + */ public void setThumbnailSizes(int[] thumbnailSizes) { Arrays.sort(thumbnailSizes); this.thumbnailSizes = thumbnailSizes; diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/PathValidator.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/PathValidator.java index 4c5dbee115e17e184ce7421cbcc5d89c1a2f46b9..c1811a6209afa7227b4ce54d9f2c5bd850da7b63 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/PathValidator.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/PathValidator.java @@ -45,7 +45,7 @@ public class PathValidator { /** * Checks if folder name is valid. * - * @param path the path + * @param name the name * @return true, if path is valid */ protected static boolean isValidFolderName(final String name) { diff --git a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/S3StorageServiceImpl.java b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/S3StorageServiceImpl.java index 5e8fc16d8378c64c48302e74920d5a078c3c9ee6..a7b1f0c3bb483a8061a9d8cc927585ec6cb5809d 100644 --- a/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/S3StorageServiceImpl.java +++ b/file-repository-core/src/main/java/org/genesys/filerepository/service/impl/S3StorageServiceImpl.java @@ -481,8 +481,7 @@ public class S3StorageServiceImpl implements BytesStorageService, InitializingBe /** * http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html * - * @param path the path - * @param filename the filename + * @param bytesFile the bytes file * @return true, if successful * @throws IOException when other stuff is bad * @throws InvalidRepositoryPathException when path or filename are weird