Search in sources :

Example 1 with ListFhirStoresResponse

use of com.google.api.services.healthcare.v1.model.ListFhirStoresResponse in project java-docs-samples by GoogleCloudPlatform.

the class FhirStoreList method fhirStoreList.

public static void fhirStoreList(String datasetName) throws IOException {
    // String datasetName =
    // String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
    // Initialize the client, which will be used to interact with the service.
    CloudHealthcare client = createClient();
    // Results are paginated, so multiple queries may be required.
    String pageToken = null;
    List<FhirStore> stores = new ArrayList<>();
    do {
        // Create request and configure any parameters.
        FhirStores.List request = client.projects().locations().datasets().fhirStores().list(datasetName).setPageSize(// Specify pageSize up to 1000
        100).setPageToken(pageToken);
        // Execute response and collect results.
        ListFhirStoresResponse response = request.execute();
        stores.addAll(response.getFhirStores());
        // Update the page token for the next request.
        pageToken = response.getNextPageToken();
    } while (pageToken != null);
    // Print results.
    System.out.printf("Retrieved %s Fhir stores: \n", stores.size());
    for (FhirStore data : stores) {
        System.out.println("\t" + data.toPrettyString());
    }
}
Also used : FhirStores(com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores) ArrayList(java.util.ArrayList) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore) ListFhirStoresResponse(com.google.api.services.healthcare.v1.model.ListFhirStoresResponse) CloudHealthcare(com.google.api.services.healthcare.v1.CloudHealthcare)

Example 2 with ListFhirStoresResponse

use of com.google.api.services.healthcare.v1.model.ListFhirStoresResponse in project beam by apache.

the class HttpHealthcareApiClient method listAllFhirStores.

@Override
public List<FhirStore> listAllFhirStores(String dataset) throws IOException {
    ArrayList<FhirStore> fhirStores = new ArrayList<>();
    String pageToken = "";
    do {
        ListFhirStoresResponse resp = client.projects().locations().datasets().fhirStores().list(dataset).setPageToken(pageToken).execute();
        for (FhirStore fs : resp.getFhirStores()) {
            fhirStores.add(fs);
        }
        if (resp.getNextPageToken() == null) {
            break;
        }
        pageToken = resp.getNextPageToken();
    } while (!pageToken.equals(""));
    return fhirStores;
}
Also used : ArrayList(java.util.ArrayList) FhirStore(com.google.api.services.healthcare.v1.model.FhirStore) ListFhirStoresResponse(com.google.api.services.healthcare.v1.model.ListFhirStoresResponse)

Aggregations

FhirStore (com.google.api.services.healthcare.v1.model.FhirStore)2 ListFhirStoresResponse (com.google.api.services.healthcare.v1.model.ListFhirStoresResponse)2 ArrayList (java.util.ArrayList)2 CloudHealthcare (com.google.api.services.healthcare.v1.CloudHealthcare)1 FhirStores (com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.FhirStores)1