Search in sources :

Example 21 with IBaseMetaType

use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.

the class FhirR5Resource 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-r5", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 22 with IBaseMetaType

use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.

the class FhirR5Resource 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-r5", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.r5.model.IdType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 23 with IBaseMetaType

use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.

the class FhirDstu2_1Resource 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-dstu2-1", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 24 with IBaseMetaType

use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.

the class FhirDstu2_1Resource 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-dstu2-1", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : Meta(org.hl7.fhir.dstu2016may.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu2016may.model.IdType) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 25 with IBaseMetaType

use of org.hl7.fhir.instance.model.api.IBaseMetaType in project camel-quarkus by apache.

the class FhirDstu2_1Resource method metaDelete.

@Path("/meta")
@DELETE
@Produces(MediaType.TEXT_PLAIN)
public int metaDelete(@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:metaDelete-dstu2-1", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : Meta(org.hl7.fhir.dstu2016may.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu2016may.model.IdType) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Aggregations

IBaseMetaType (org.hl7.fhir.instance.model.api.IBaseMetaType)34 HashMap (java.util.HashMap)32 JsonObject (javax.json.JsonObject)24 Path (javax.ws.rs.Path)24 Produces (javax.ws.rs.Produces)24 GET (javax.ws.rs.GET)12 CamelSpringBootTest (org.apache.camel.test.spring.junit5.CamelSpringBootTest)10 Test (org.junit.jupiter.api.Test)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 DELETE (javax.ws.rs.DELETE)6 POST (javax.ws.rs.POST)6 Meta (org.hl7.fhir.dstu3.model.Meta)4 Meta (org.hl7.fhir.r4.model.Meta)4 IdDt (ca.uhn.fhir.model.primitive.IdDt)3 IdType (org.hl7.fhir.dstu2.model.IdType)3 IdType (org.hl7.fhir.dstu2016may.model.IdType)3 IdType (org.hl7.fhir.dstu3.model.IdType)3 IdType (org.hl7.fhir.r4.model.IdType)3 IdType (org.hl7.fhir.r5.model.IdType)3 MetaDt (ca.uhn.fhir.model.dstu2.composite.MetaDt)2