Class BulkDataUtils
- java.lang.Object
 - 
- com.ibm.fhir.jbatch.bulkdata.common.BulkDataUtils
 
 
- 
public class BulkDataUtils extends Object
Utility functions for IBM COS. 
- 
- 
Constructor Summary
Constructors Constructor Description BulkDataUtils() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanupTransientUserData(ImportTransientUserData transientUserData, boolean isAbort)static voidfinishMultiPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, String uploadID, List<com.ibm.cloud.objectstorage.services.s3.model.PartETag> dataPacks)static com.ibm.cloud.objectstorage.services.s3.AmazonS3getCosClient(String cosCredentialIbm, String cosApiKeyProperty, String cosSrvinstId, String cosEndpointUrl, String cosLocation, boolean useFhirServerTrustStore)static longgetCosFileSize(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName)static javax.json.JsonArraygetDataSourcesFromJobInput(String dataSourcesInfo)static longgetHttpsFileSize(String dataUrl)static longgetLocalFileSize(String filePath)static Map<Class<? extends Resource>,List<Map<String,List<String>>>>getSearchParemetersFromTypeFilters(String typeFilters)static voidlistBuckets(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient)static com.ibm.cloud.objectstorage.services.s3.model.PartETagmultiPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, String uploadID, InputStream dataStream, int partSize, int partNum)static intreadFhirResourceFromHttps(String dataUrl, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData)static intreadFhirResourceFromLocalFile(String filePath, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData)static intreadFhirResourceFromObjectStore(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData)static StringstartPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, boolean isPublicAccess)static List<OperationOutcome.Issue>validateInput(Resource resource)Validate the input resource and throw if there are validation errors 
 - 
 
- 
- 
Method Detail
- 
startPartUpload
public static String startPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, boolean isPublicAccess) throws Exception
- Throws:
 Exception
 
- 
getCosClient
public static com.ibm.cloud.objectstorage.services.s3.AmazonS3 getCosClient(String cosCredentialIbm, String cosApiKeyProperty, String cosSrvinstId, String cosEndpointUrl, String cosLocation, boolean useFhirServerTrustStore)
 
- 
multiPartUpload
public static com.ibm.cloud.objectstorage.services.s3.model.PartETag multiPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, String uploadID, InputStream dataStream, int partSize, int partNum) throws Exception- Throws:
 Exception
 
- 
finishMultiPartUpload
public static void finishMultiPartUpload(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, String uploadID, List<com.ibm.cloud.objectstorage.services.s3.model.PartETag> dataPacks) throws Exception- Throws:
 Exception
 
- 
listBuckets
public static void listBuckets(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient)
 
- 
cleanupTransientUserData
public static void cleanupTransientUserData(ImportTransientUserData transientUserData, boolean isAbort) throws Exception
- Throws:
 Exception
 
- 
readFhirResourceFromObjectStore
public static int readFhirResourceFromObjectStore(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData) throws Exception- Parameters:
 cosClient- - COS/S3 client.bucketName- - COS/S3 bucket name to read from.itemName- - COS/S3 object name to read from.numOfLinesToSkip- - number of lines to skip before read.fhirResources- - List holds the FHIR resources.transientUserData- - transient user data for the chunk.- Returns:
 - - number of parsing failures.
 - Throws:
 Exception
 
- 
getCosFileSize
public static long getCosFileSize(com.ibm.cloud.objectstorage.services.s3.AmazonS3 cosClient, String bucketName, String itemName) throws Exception- Throws:
 Exception
 
- 
readFhirResourceFromLocalFile
public static int readFhirResourceFromLocalFile(String filePath, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData) throws Exception
- Parameters:
 filePath- - file path to the ndjson file.numOfLinesToSkip- - number of lines to skip before read.fhirResources- - List holds the FHIR resources.transientUserData- - transient user data for the chunk.- Returns:
 - - number of parsing failures.
 - Throws:
 Exception
 
- 
getLocalFileSize
public static long getLocalFileSize(String filePath) throws Exception
- Throws:
 Exception
 
- 
readFhirResourceFromHttps
public static int readFhirResourceFromHttps(String dataUrl, int numOfLinesToSkip, List<Resource> fhirResources, ImportTransientUserData transientUserData) throws Exception
- Parameters:
 dataUrl- - URL to the ndjson file.numOfLinesToSkip- - number of lines to skip before read.fhirResources- - List holds the FHIR resources.transientUserData- - transient user data for the chunk.- Returns:
 - - number of parsing failures.
 - Throws:
 Exception
 
- 
getHttpsFileSize
public static long getHttpsFileSize(String dataUrl) throws Exception
- Throws:
 Exception
 
- 
validateInput
public static List<OperationOutcome.Issue> validateInput(Resource resource) throws FHIRValidationException, FHIROperationException
Validate the input resource and throw if there are validation errors- Parameters:
 resource-- Throws:
 FHIRValidationExceptionFHIROperationException
 
- 
getSearchParemetersFromTypeFilters
public static Map<Class<? extends Resource>,List<Map<String,List<String>>>> getSearchParemetersFromTypeFilters(String typeFilters) throws Exception
- Throws:
 Exception
 
- 
getDataSourcesFromJobInput
public static javax.json.JsonArray getDataSourcesFromJobInput(String dataSourcesInfo)
 
 - 
 
 -