@Component public class StorageFileHelper extends Object
| Constructor and Description |
|---|
StorageFileHelper() |
| Modifier and Type | Method and Description |
|---|---|
StorageFile |
createStorageFileFromEntity(StorageFileEntity storageFileEntity)
Creates a storage file from the storage file entity.
|
List<StorageFile> |
createStorageFilesFromEntities(Collection<StorageFileEntity> storageFileEntities)
Creates a list of storage files from the collection of storage file entities.
|
List<StorageFile> |
createStorageFilesFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Creates a list of storage files from the list of S3 object summaries.
|
List<StorageFile> |
getAndValidateStorageFiles(StorageUnitEntity storageUnitEntity,
String s3KeyPrefix,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Retrieves and validates a list of storage files registered with the specified storage unit.
|
List<StorageFile> |
getAndValidateStorageFilesIfPresent(StorageUnitEntity storageUnitEntity,
String s3KeyPrefix,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Retrieves and validates a list of storage files registered with the specified storage unit.
|
List<String> |
getFilePathsFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Returns a list of file paths extracted from the specified list of S3 object summaries.
|
List<String> |
getFilePathsFromStorageFiles(List<StorageFile> storageFiles)
Returns a list of file paths extracted from the specified list of storage files.
|
List<File> |
getFiles(List<StorageFile> storageFiles)
Returns a list of files extracted from the specified list of storage files.
|
Map<String,StorageFileEntity> |
getStorageFileEntitiesMap(Collection<StorageFileEntity> storageFileEntities)
Returns a map of file paths to the storage file entities build from the list of storage file entities.
|
Map<String,StorageFile> |
getStorageFilesMapFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Returns a map of file paths to the storage files build from the list of S3 object summaries with map iteration order matching the original list order.
|
void |
validateCreateRequestStorageFiles(List<StorageFile> storageFiles)
Validates a list of storage files.
|
void |
validateDownloadedS3Files(String baseDirectory,
String s3KeyPrefix,
List<StorageFile> storageFiles)
Validate downloaded S3 files per specified list of storage files.
|
void |
validateDownloadedS3Files(String baseDirectory,
String s3KeyPrefix,
StorageUnit storageUnit)
Validate downloaded S3 files per storage unit information.
|
void |
validateRegisteredS3Files(List<StorageFile> expectedStorageFiles,
List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Validates registered S3 files per list of expected storage files.
|
void |
validateStorageFile(StorageFile storageFile,
String s3BucketName,
Map<String,StorageFile> actualS3Keys,
boolean validateFileSize)
Validates storage file against the actual S3 objects reported by S3.
|
void |
validateStorageFileEntity(StorageFileEntity storageFileEntity,
String s3BucketName,
Map<String,StorageFile> actualS3Keys,
boolean validateFileSize)
Validates storage file entity against the actual S3 objects reported by S3.
|
void |
validateStorageFilePaths(Collection<String> storageFilePaths,
String s3KeyPrefix,
BusinessObjectDataKey businessObjectDataKey,
String storageName)
Validates a list of storage file paths.
|
void |
validateStorageUnitS3Files(StorageUnit storageUnit,
List<String> actualS3Files,
String s3KeyPrefix)
Validates S3 files per storage unit information.
|
public StorageFile createStorageFileFromEntity(StorageFileEntity storageFileEntity)
storageFileEntity - the storage file entitypublic List<StorageFile> createStorageFilesFromEntities(Collection<StorageFileEntity> storageFileEntities)
storageFileEntities - the collection of storage file entitiespublic List<StorageFile> createStorageFilesFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of S3 object summariespublic List<StorageFile> getAndValidateStorageFiles(StorageUnitEntity storageUnitEntity, String s3KeyPrefix, String storageName, BusinessObjectDataKey businessObjectDataKey)
storageUnitEntity - the storage unit entity the storage file paths to be validateds3KeyPrefix - the S3 key prefix that storage file paths are expected to start withstorageName - the storage namebusinessObjectDataKey - the business object data keypublic List<StorageFile> getAndValidateStorageFilesIfPresent(StorageUnitEntity storageUnitEntity, String s3KeyPrefix, String storageName, BusinessObjectDataKey businessObjectDataKey)
storageUnitEntity - the storage unit entity the storage file paths to be validateds3KeyPrefix - the S3 key prefix that storage file paths are expected to start withstorageName - the storage namebusinessObjectDataKey - the business object data keypublic List<String> getFilePathsFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of of S3 object summariespublic List<String> getFilePathsFromStorageFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic List<File> getFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic Map<String,StorageFileEntity> getStorageFileEntitiesMap(Collection<StorageFileEntity> storageFileEntities)
storageFileEntities - the collection of storage file entitiespublic Map<String,StorageFile> getStorageFilesMapFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of S3 object summariespublic void validateCreateRequestStorageFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic void validateDownloadedS3Files(String baseDirectory, String s3KeyPrefix, StorageUnit storageUnit) throws IllegalStateException
baseDirectory - the local parent directory path, relative to which the files are expected to be locateds3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3storageUnit - the storage unit that contains a list of storage files to be validatedIllegalStateException - if files are not validpublic void validateDownloadedS3Files(String baseDirectory, String s3KeyPrefix, List<StorageFile> storageFiles) throws IllegalStateException
baseDirectory - the local parent directory path, relative to which the files are expected to be locateds3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3storageFiles - the list of storage filesIllegalStateException - if files are not validpublic void validateRegisteredS3Files(List<StorageFile> expectedStorageFiles, List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries, String storageName, BusinessObjectDataKey businessObjectDataKey)
expectedStorageFiles - the list of expected S3 files represented by storage filess3ObjectSummaries - the list of actual S3 files represented by S3 object summariesstorageName - the storage namebusinessObjectDataKey - the business object data keypublic void validateStorageFile(StorageFile storageFile, String s3BucketName, Map<String,StorageFile> actualS3Keys, boolean validateFileSize)
storageFile - the storage file to be validateds3BucketName - the S3 bucket nameactualS3Keys - the map of storage file paths to storage files as reported by S3validateFileSize - specifies whether file size validation is required or notpublic void validateStorageFileEntity(StorageFileEntity storageFileEntity, String s3BucketName, Map<String,StorageFile> actualS3Keys, boolean validateFileSize)
storageFileEntity - the storage file to be validateds3BucketName - the S3 bucket nameactualS3Keys - the map of storage file paths to storage files as reported by S3validateFileSize - specifies whether file size validation is required or notpublic void validateStorageFilePaths(Collection<String> storageFilePaths, String s3KeyPrefix, BusinessObjectDataKey businessObjectDataKey, String storageName)
storageFilePaths - the storage file paths to be validateds3KeyPrefix - the S3 key prefix that storage file paths are expected to start withbusinessObjectDataKey - the business object data keystorageName - the name of the storage that storage files are stored inpublic void validateStorageUnitS3Files(StorageUnit storageUnit, List<String> actualS3Files, String s3KeyPrefix)
storageUnit - the storage unit that contains S3 files to be validatedactualS3Files - the list of the actual S3 filess3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3Copyright © 2019. All rights reserved.