/** * Retrieves and validates a list of storage files registered with the specified storage unit. This method makes sure that the list of storage files is not * empty and that all storage files match the expected s3 key prefix value. * * @param storageUnitEntity the storage unit entity the storage file paths to be validated * @param s3KeyPrefix the S3 key prefix that storage file paths are expected to start with * @param storageName the storage name * @param businessObjectDataKey the business object data key * * @return the list of storage files */ public List<StorageFile> getAndValidateStorageFiles(StorageUnitEntity storageUnitEntity, String s3KeyPrefix, String storageName, BusinessObjectDataKey businessObjectDataKey) { // Check if the list of storage files is not empty. if (CollectionUtils.isEmpty(storageUnitEntity.getStorageFiles())) { throw new IllegalArgumentException(String .format("Business object data has no storage files registered in \"%s\" storage. Business object data: {%s}", storageName, businessObjectDataHelper.businessObjectDataKeyToString(businessObjectDataKey))); } // Retrieve storage files. List<StorageFile> storageFiles = createStorageFilesFromEntities(storageUnitEntity.getStorageFiles()); // Validate storage file paths registered with this business object data in the specified storage. validateStorageFilePaths(getFilePathsFromStorageFiles(storageFiles), s3KeyPrefix, storageUnitEntity.getBusinessObjectData(), storageName); // Return the list of storage files. return storageFiles; }
/** * Retrieves and validates a list of storage files registered with the specified storage unit. This method makes sure that the list of storage files is not * empty and that all storage files match the expected s3 key prefix value. * * @param storageUnitEntity the storage unit entity the storage file paths to be validated * @param s3KeyPrefix the S3 key prefix that storage file paths are expected to start with * @param storageName the storage name * @param businessObjectDataKey the business object data key * * @return the list of storage files */ public List<StorageFile> getAndValidateStorageFiles(StorageUnitEntity storageUnitEntity, String s3KeyPrefix, String storageName, BusinessObjectDataKey businessObjectDataKey) { // Check if the list of storage files is not empty. if (CollectionUtils.isEmpty(storageUnitEntity.getStorageFiles())) { throw new IllegalArgumentException(String .format("Business object data has no storage files registered in \"%s\" storage. Business object data: {%s}", storageName, businessObjectDataHelper.businessObjectDataKeyToString(businessObjectDataKey))); } // Retrieve storage files. List<StorageFile> storageFiles = createStorageFilesFromEntities(storageUnitEntity.getStorageFiles()); // Validate storage file paths registered with this business object data in the specified storage. validateStorageFilePaths(getFilePathsFromStorageFiles(storageFiles), s3KeyPrefix, storageUnitEntity.getBusinessObjectData(), storageName); // Return the list of storage files. return storageFiles; }
storageFileHelper.validateStorageFilePaths(storageFilePaths, s3KeyPrefix, storageUnitEntity.getBusinessObjectData(), storageUnitEntity.getStorage().getName());
storageFileHelper.validateStorageFilePaths(storageFilePaths, s3KeyPrefix, storageUnitEntity.getBusinessObjectData(), storageUnitEntity.getStorage().getName());