Class BulkDataUtils


  • public class BulkDataUtils
    extends Object
    Utility functions for IBM COS.
    • Constructor Detail

      • BulkDataUtils

        public BulkDataUtils()
    • 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
      • 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
        Use the passed cosClient to upload part of a multi-part object
        Parameters:
        cosClient -
        bucketName -
        itemName -
        uploadID -
        dataStream -
        partSize -
        partNum -
        Returns:
        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
      • 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
      • 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
      • getDataSourcesFromJobInput

        public static javax.json.JsonArray getDataSourcesFromJobInput​(String dataSourcesInfo)