use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.
the class FhirDstu3Resource method metaGetFromType.
@Path("/meta/getFromType")
@GET
@Produces(MediaType.TEXT_PLAIN)
public int metaGetFromType(@QueryParam("preferResponseType") boolean preferResponseType) {
Map<String, Object> headers = new HashMap<>();
headers.put("CamelFhir.metaType", Meta.class);
headers.put("CamelFhir.resourceType", "Patient");
if (preferResponseType) {
headers.put(ExtraParameters.PREFER_RESPONSE_TYPE.getHeaderName(), Patient.class);
}
IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaGetFromType-dstu3", null, headers, IBaseMetaType.class);
return result.getTag().size();
}
use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-spring-boot by apache.
the class FhirMetaIT 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.instance.model.api.IBaseMetaType in project camel-spring-boot by apache.
the class FhirMetaIT 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.instance.model.api.IBaseMetaType in project camel-spring-boot by apache.
the class FhirMetaIT method testGetFromResource.
@Test
public void testGetFromResource() throws Exception {
final Map<String, Object> headers = new HashMap<>();
// parameter type is Class
headers.put("CamelFhir.metaType", Meta.class);
// parameter type is org.hl7.fhir.instance.model.api.IIdType
headers.put("CamelFhir.id", this.patient.getIdElement());
IBaseMetaType result = requestBodyAndHeaders("direct://GET_FROM_RESOURCE", null, headers);
LOG.debug("getFromResource: " + result);
assertNotNull(result, "getFromResource result");
assertEquals(0, result.getTag().size());
}
use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.
the class FhirR4Resource 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-r4", null, headers, IBaseMetaType.class);
return result.getTag().size();
}
Aggregations