use of org.hl7.fhir.r4b.model.Meta in project dpc-app by CMSgov.
the class MockBlueButtonClientV2 method requestNextBundleFromServer.
@Override
// Date class is used by FHIR stu3 Meta model
@SuppressWarnings("JdkObsolete")
public Bundle requestNextBundleFromServer(Bundle bundle, Map<String, String> headers) throws ResourceNotFoundException {
// This is code is very specific to the bb-test-data directory and its contents
final var nextLink = bundle.getLink(Bundle.LINK_NEXT).getUrl();
final var nextUrl = URI.create(nextLink);
final var params = URLEncodedUtils.parse(nextUrl.getQuery(), StandardCharsets.UTF_8);
final var patient = params.stream().filter(pair -> pair.getName().equals("patient")).findFirst().orElseThrow().getValue();
final var startIndex = params.stream().filter(pair -> pair.getName().equals("startIndex")).findFirst().orElseThrow().getValue();
var path = SAMPLE_EOB_PATH_PREFIX + patient + "_" + startIndex + ".xml";
try (InputStream sampleData = MockBlueButtonClientV2.class.getClassLoader().getResourceAsStream(path)) {
final var nextBundle = parser.parseResource(Bundle.class, sampleData);
nextBundle.getMeta().setLastUpdated(Date.from(BFD_TRANSACTION_TIME.toInstant()));
return nextBundle;
} catch (IOException ex) {
throw new ResourceNotFoundException("Missing next bundle");
}
}
use of org.hl7.fhir.r4b.model.Meta in project dpc-app by CMSgov.
the class FHIRBuilders method addOrganizationTag.
/**
* Add Organization ID to {@link Resource} {@link Meta}
*
* @param resource - {@link Resource} to add (or update) {@link Meta}
* @param organizationID - {@link UUID} Organization ID
*/
public static void addOrganizationTag(Resource resource, UUID organizationID) {
Meta meta = resource.getMeta();
if (meta == null) {
meta = new Meta();
}
// Add the Organization ID
meta.addTag(DPCIdentifierSystem.DPC.getSystem(), organizationID.toString(), "Organization ID");
resource.setMeta(meta);
}
use of org.hl7.fhir.r4b.model.Meta in project camel-quarkus by apache.
the class FhirDstu2Hl7OrgResource method metaGetFromResource.
@Path("/meta/getFromResource")
@GET
@Produces(MediaType.TEXT_PLAIN)
public int metaGetFromResource(@QueryParam("id") String id) {
IdType iIdType = new IdType(id);
final Map<String, Object> headers = new HashMap<>();
headers.put("CamelFhir.metaType", Meta.class);
headers.put("CamelFhir.id", iIdType);
IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaGetFromResource-dstu2-hl7org", null, headers, IBaseMetaType.class);
return result.getTag().size();
}
use of org.hl7.fhir.r4b.model.Meta in project camel-quarkus by apache.
the class FhirR5Resource method metaAdd.
// ///////////////////
// Meta
// ///////////////////
@Path("/meta")
@POST
@Produces(MediaType.TEXT_PLAIN)
public int metaAdd(@QueryParam("id") String id) {
IdType iIdType = new IdType(id);
Meta inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
Map<String, Object> headers = new HashMap<>();
headers.put("CamelFhir.meta", inMeta);
headers.put("CamelFhir.id", iIdType);
IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaAdd-r5", null, headers, IBaseMetaType.class);
return result.getTag().size();
}
use of org.hl7.fhir.r4b.model.Meta in project camel-quarkus by apache.
the class FhirDstu2Resource method metaAdd.
// ///////////////////
// Meta
// ///////////////////
@Path("/meta")
@POST
@Produces(MediaType.TEXT_PLAIN)
public int metaAdd(@QueryParam("id") String id) {
IdDt iIdType = new IdDt(id);
MetaDt inMeta = new MetaDt();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
Map<String, Object> headers = new HashMap<>();
headers.put("CamelFhir.meta", inMeta);
headers.put("CamelFhir.id", iIdType);
IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaAdd-dstu2", null, headers, IBaseMetaType.class);
return result.getTag().size();
}
Aggregations