Search in sources :

Example 31 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirR5Resource method operationOnInstanceVersion.

@Path("/operation/onInstanceVersion")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstanceVersion(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstanceVersion-r5", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : Parameters(org.hl7.fhir.r5.model.Parameters) ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) HashMap(java.util.HashMap) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r5.model.Bundle) 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 32 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirDstu2_1Resource method operationOnInstance.

// ///////////////////
// Operation
// ///////////////////
@Path("/operation/onInstance")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstance(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstance-dstu2-1", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : Parameters(org.hl7.fhir.dstu2016may.model.Parameters) ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.dstu2016may.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu2016may.model.IdType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 33 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirDstu3Resource method operationOnInstanceVersion.

@Path("/operation/onInstanceVersion")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstanceVersion(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstanceVersion-dstu3", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) Parameters(org.hl7.fhir.dstu3.model.Parameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.dstu3.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu3.model.IdType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 34 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project gpconnect-demonstrator by nhsconnect.

the class PatientResourceProvider method addWarningIssue.

/**
 * see
 * https://gpconnect-1-2-4.netlify.com/accessrecord_structured_development_version_compatibility.html
 * add an issue to the OperationOutcome to be returned in a successful
 * response bundle this is for forward compatibility as specified in 1.2.4
 *
 * @param param
 * @param paramPart
 * @param issueType
 * @param details lower level details to be added to the text element
 */
private void addWarningIssue(ParametersParameterComponent param, ParametersParameterComponent paramPart, IssueType issueType, String details) {
    if (operationOutcome == null) {
        createOperationOutcome();
    }
    OperationOutcomeIssueComponent issue = new OperationOutcomeIssueComponent();
    issue.setSeverity(OperationOutcome.IssueSeverity.WARNING);
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = new Coding();
    coding.setSystem(VS_GPC_ERROR_WARNING_CODE);
    switch(issueType) {
        case NOTSUPPORTED:
            issue.setCode(issueType);
            coding.setCode(SystemCode.NOT_IMPLEMENTED);
            coding.setDisplay("Not implemented");
            break;
        case REQUIRED:
            issue.setCode(issueType);
            coding.setCode(SystemCode.PARAMETER_NOT_FOUND);
            coding.setDisplay("Parameter not found");
            break;
        case INVALID:
            issue.setCode(issueType);
            coding.setCode(SystemCode.INVALID_PARAMETER);
            coding.setDisplay("Invalid Parameter");
            break;
    }
    codeableConcept.addCoding(coding);
    issue.setDetails(codeableConcept);
    String locus = paramPart != null ? "." + paramPart.getName() : "";
    issue.setDiagnostics(param.getName() + locus);
    if (details == null) {
        // mod to remove more informative text which was off spec
        codeableConcept.setText(param.getName() + locus + " is an unrecognised parameter");
    } else {
        codeableConcept.setText(details);
    }
    operationOutcome.addIssue(issue);
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)

Example 35 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirR4Resource method operationOnInstance.

// ///////////////////
// Operation
// ///////////////////
@Path("/operation/onInstance")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstance(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstance-r4", null, headers, Parameters.class);
    ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) Parameters(org.hl7.fhir.r4.model.Parameters) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) HashMap(java.util.HashMap) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r4.model.Bundle) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.r4.model.IdType) ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ParametersParameterComponent (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)26 Parameters (org.hl7.fhir.r4.model.Parameters)21 HashMap (java.util.HashMap)18 JsonObject (javax.json.JsonObject)15 GET (javax.ws.rs.GET)15 Path (javax.ws.rs.Path)15 Produces (javax.ws.rs.Produces)15 ExtraParameters (org.apache.camel.component.fhir.api.ExtraParameters)15 IBaseBundle (org.hl7.fhir.instance.model.api.IBaseBundle)15 FHIRException (org.hl7.fhir.exceptions.FHIRException)12 IOException (java.io.IOException)7 CodeType (org.hl7.fhir.r4.model.CodeType)7 URISyntaxException (java.net.URISyntaxException)6 Nonnull (javax.annotation.Nonnull)6 Parameters (org.hl7.fhir.dstu3.model.Parameters)6 ParametersParameterComponent (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent)6 Bundle (org.hl7.fhir.r4.model.Bundle)6 Slf4j (lombok.extern.slf4j.Slf4j)5 Parameters (org.hl7.fhir.dstu2.model.Parameters)5 Parameters (org.hl7.fhir.dstu2016may.model.Parameters)5