use of org.hl7.fhir.dstu3.model.ResourceType in project openmrs-module-fhir2 by openmrs.
the class PatientFhirResourceProviderIntegrationTest method shouldReturnPatientTypeEverythingAsXml.
@Test
public void shouldReturnPatientTypeEverythingAsXml() throws Exception {
MockHttpServletResponse response = get("/Patient/$everything").accept(FhirMediaTypes.XML).go();
assertThat(response, isOk());
assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
assertThat(response.getContentAsString(), notNullValue());
Bundle result = readBundleResponse(response);
assertThat(result, notNullValue());
assertThat(result.getType(), equalTo(Bundle.BundleType.SEARCHSET));
assertThat(result, hasProperty("total", equalTo(46)));
assertThat(result.getEntry(), hasSize(46));
List<Bundle.BundleEntryComponent> entries = result.getEntry();
assertThat(entries, everyItem(hasProperty("fullUrl", startsWith("http://localhost/ws/fhir2/R3/"))));
assertThat(entries, everyItem(hasResource(hasProperty("resourceType", in(getEverythingValidResourceTypes())))));
}
use of org.hl7.fhir.dstu3.model.ResourceType in project Gravity-SDOH-Exchange-RI by FHIR.
the class ResourceLoader method getResourcesBySystem.
public Map<Class<? extends Resource>, List<Resource>> getResourcesBySystem(IGenericClient client, String system, List<Reference> references) {
if (references.isEmpty()) {
return Collections.emptyMap();
}
Bundle loadResourcesBundle = new Bundle();
loadResourcesBundle.setType(BundleType.TRANSACTION);
references.stream().map(BaseReference::getReferenceElement).collect(Collectors.groupingBy(IIdType::getResourceType)).forEach((resourceType, referenceElements) -> {
StringBuilder urlBuilder = new StringBuilder(resourceType).append("?").append("identifier").append("=");
String searchParams = referenceElements.stream().map(element -> new StringBuilder(system).append("|").append(element.getIdPart())).map(StringBuilder::toString).collect(Collectors.joining(","));
urlBuilder.append(searchParams);
loadResourcesBundle.addEntry(FhirUtil.createGetEntry(urlBuilder.toString()));
});
return client.transaction().withBundle(loadResourcesBundle).execute().getEntry().stream().map(BundleEntryComponent::getResource).filter(Bundle.class::isInstance).map(Bundle.class::cast).map(Bundle::getEntry).flatMap(List::stream).map(BundleEntryComponent::getResource).collect(Collectors.groupingBy(Resource::getClass));
}
use of org.hl7.fhir.dstu3.model.ResourceType in project pathling by aehrc.
the class FhirServer method buildAggregateProviders.
@Nonnull
private List<IResourceProvider> buildAggregateProviders() {
final List<IResourceProvider> providers = new ArrayList<>();
// Instantiate an aggregate provider for every resource type in FHIR.
for (final ResourceType resourceType : ResourceType.values()) {
final IResourceProvider aggregateProvider = resourceProviderFactory.createAggregateResourceProvider(resourceType);
providers.add(aggregateProvider);
}
return providers;
}
use of org.hl7.fhir.dstu3.model.ResourceType in project pathling by aehrc.
the class FhirServer method buildExtractProviders.
@Nonnull
private List<IResourceProvider> buildExtractProviders() {
final List<IResourceProvider> providers = new ArrayList<>();
// Instantiate an extract provider for every resource type in FHIR.
for (final ResourceType resourceType : ResourceType.values()) {
final IResourceProvider extractProvider = resourceProviderFactory.createExtractResourceProvider(resourceType);
providers.add(extractProvider);
}
return providers;
}
use of org.hl7.fhir.dstu3.model.ResourceType in project pathling by aehrc.
the class FhirServer method buildSearchProviders.
@Nonnull
private List<IResourceProvider> buildSearchProviders() {
final List<IResourceProvider> providers = new ArrayList<>();
// Instantiate a search provider for every resource type in FHIR.
for (final ResourceType resourceType : ResourceType.values()) {
final IResourceProvider searchProvider = resourceProviderFactory.createSearchResourceProvider(resourceType);
providers.add(searchProvider);
}
return providers;
}
Aggregations