use of org.hl7.fhir.r4.model.Meta in project nia-patient-switching-standard-adaptor by NHSDigital.
the class BundleGenerator method generateBundle.
public Bundle generateBundle() {
Bundle bundle = new Bundle();
Meta meta = new Meta();
meta.setProfile(List.of(new UriType("https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-StructuredRecord-Bundle-1")));
bundle.setId(idGeneratorService.generateUuid());
bundle.setMeta(meta);
bundle.setType(Bundle.BundleType.COLLECTION);
return bundle;
}
use of org.hl7.fhir.r4.model.Meta in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ResourceUtil method generateMeta.
public static Meta generateMeta(String urlProfile) {
Meta meta = new Meta();
UriType profile = new UriType(String.format(META_PROFILE_TEMPLATE, urlProfile));
meta.setProfile(List.of(profile));
return meta;
}
use of org.hl7.fhir.r4.model.Meta in project camel-spring-boot by apache.
the class FhirMetaTest method testDelete.
@Test
public void testDelete() throws Exception {
// assert no meta
Meta meta = fhirClient.meta().get(Meta.class).fromResource(this.patient.getIdElement()).execute();
assertEquals(0, meta.getTag().size());
Meta inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
// add meta
meta = fhirClient.meta().add().onResource(this.patient.getIdElement()).meta(inMeta).execute();
assertEquals(1, meta.getTag().size());
// delete meta
final Map<String, Object> headers = new HashMap<>();
// parameter type is org.hl7.fhir.instance.model.api.IBaseMetaType
headers.put("CamelFhir.meta", meta);
// parameter type is org.hl7.fhir.instance.model.api.IIdType
headers.put("CamelFhir.id", this.patient.getIdElement());
IBaseMetaType result = requestBodyAndHeaders("direct://DELETE", null, headers);
LOG.debug("delete: " + result);
assertNotNull(result, "delete result");
assertEquals(0, result.getTag().size());
}
use of org.hl7.fhir.r4.model.Meta in project camel-spring-boot by apache.
the class FhirMetaTest method testAdd.
@Test
public void testAdd() throws Exception {
// assert no meta
Meta meta = fhirClient.meta().get(Meta.class).fromResource(this.patient.getIdElement()).execute();
assertEquals(0, meta.getTag().size());
Meta inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
final Map<String, Object> headers = new HashMap<>();
// parameter type is org.hl7.fhir.instance.model.api.IBaseMetaType
headers.put("CamelFhir.meta", inMeta);
// parameter type is org.hl7.fhir.instance.model.api.IIdType
headers.put("CamelFhir.id", this.patient.getIdElement());
IBaseMetaType result = requestBodyAndHeaders("direct://ADD", null, headers);
LOG.debug("add: " + result);
assertNotNull(result, "add result");
assertEquals(1, result.getTag().size());
}
use of org.hl7.fhir.r4.model.Meta in project syndesis by syndesisio.
the class FhirTransactionTest method transactionTest.
@Test
@SuppressWarnings("JdkObsolete")
public void transactionTest() {
Bundle bundle = new Bundle();
bundle.addEntry(new Bundle.BundleEntryComponent().setResource(new Account().setId("1").setMeta(new Meta().setLastUpdated(new Date()))));
bundle.addEntry(new Bundle.BundleEntryComponent().setResource(new Patient().setId("2").setMeta(new Meta().setLastUpdated(new Date()))));
stubFhirRequest(post(urlEqualTo("/?_format=xml")).withRequestBody(containing("<type value=\"transaction\"/><total value=\"2\"/><link><relation value=\"fhir-base\"/></link>" + "<link><relation value=\"self\"/></link>" + "<entry><resource><Account xmlns=\"http://hl7.org/fhir\"><name value=\"Joe\"/></Account></resource>" + "<request><method value=\"POST\"/></request></entry><entry><resource>" + "<Patient xmlns=\"http://hl7.org/fhir\"><name><family value=\"Jackson\"/></name></Patient></resource>" + "<request><method value=\"POST\"/></request></entry>")).willReturn(okXml(toXml(bundle))));
template.requestBody("direct:start", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<tns:Transaction xmlns:tns=\"http://hl7.org/fhir\">" + "<tns:Account><tns:name value=\"Joe\"/></tns:Account>" + "<tns:Patient><name><tns:family value=\"Jackson\"/></name></tns:Patient></tns:Transaction>");
}
Aggregations