use of com.google.api.services.healthcare.v1.model.Empty in project beam by apache.
the class HL7V2MessagePagesTest method test_EmptyStoreEmptyIterator.
/**
* Test empty store.
*/
@Test
public void test_EmptyStoreEmptyIterator() throws IOException {
Mockito.doReturn(new ListMessagesResponse()).when(client).makeSendTimeBoundHL7v2ListRequest("foo", null, null, null, null, null);
HL7v2MessagePages emptyPages = new HL7v2MessagePages(client, "foo", null, null);
// In the case that the store is empty we should return a single empty list.
assertFalse(emptyPages.iterator().hasNext());
}
use of com.google.api.services.healthcare.v1.model.Empty in project beam by apache.
the class HttpHealthcareApiClient method uploadToDicomStore.
@Override
public Empty uploadToDicomStore(String webPath, String filePath) throws IOException, URISyntaxException {
byte[] dcmFile = Files.readAllBytes(Paths.get(filePath));
ByteArrayEntity requestEntity = new ByteArrayEntity(dcmFile);
String uri = String.format("%sv1/%s/dicomWeb/studies", client.getRootUrl(), webPath);
URIBuilder uriBuilder = new URIBuilder(uri).setParameter("access_token", credentials.getAccessToken().getTokenValue());
HttpUriRequest request = RequestBuilder.post(uriBuilder.build()).setEntity(requestEntity).addHeader("Content-Type", "application/dicom").build();
httpClient.execute(request);
return new Empty();
}
use of com.google.api.services.healthcare.v1.model.Empty in project java-docs-samples by GoogleCloudPlatform.
the class BatchOperationSample method batchDeleteJobs.
// [END batch_job_update]
// [START batch_job_delete]
public static void batchDeleteJobs(List<Job> jobsToBeDeleted) throws IOException {
BatchRequest batchDelete = talentSolutionClient.batch();
for (Job job : jobsToBeDeleted) {
talentSolutionClient.projects().jobs().delete(job.getName()).queue(batchDelete, new JsonBatchCallback<Empty>() {
@Override
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
System.out.println("Delete Error Message: " + e.getMessage());
}
@Override
public void onSuccess(Empty empty, HttpHeaders responseHeaders) {
System.out.println("Job deleted");
}
});
batchDelete.execute();
}
}
use of com.google.api.services.healthcare.v1.model.Empty in project jaxb-ri by eclipse-ee4j.
the class XmlSchemaBuilder method modelGroup.
@Override
public Leaf modelGroup(XSModelGroup mg) {
XSParticle[] children = mg.getChildren();
if (children.length == 0)
return new Empty(mg.getLocator());
Leaf l = particle(children[0]);
for (int i = 1; i < children.length; i++) l.merge(particle(children[i]));
return l;
}
use of com.google.api.services.healthcare.v1.model.Empty in project beam by apache.
the class HttpHealthcareApiClient method getEarliestHL7v2SendTime.
@Override
public Instant getEarliestHL7v2SendTime(String hl7v2Store, @Nullable String filter) throws IOException {
ListMessagesResponse response = client.projects().locations().datasets().hl7V2Stores().messages().list(hl7v2Store).setFilter(filter).set("view", // needed to retrieve the value for sendtime
"full").setOrderBy(// default order is ascending
"sendTime").setPageSize(// Only interested in the earliest sendTime
1).execute();
if (response.isEmpty()) {
throw new IllegalArgumentException(String.format("Could not find earliest send time. The filter %s matched no results on " + "HL7v2 Store: %s", filter, hl7v2Store));
}
String sendTime = response.getHl7V2Messages().get(0).getSendTime();
if (Strings.isNullOrEmpty(sendTime)) {
LOG.warn(String.format("Earliest message in %s has null or empty sendTime defaulting to Epoch.", hl7v2Store));
return Instant.ofEpochMilli(0);
}
// https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages#Message
return Instant.parse(sendTime);
}
Aggregations