camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [camel-quarkus] johnpoth commented on a change in pull request #478: Fixes native test and add support for FHIR R5 specification
Date Wed, 27 Nov 2019 11:40:00 GMT
johnpoth commented on a change in pull request #478: Fixes native test and add support for
FHIR R5 specification
URL: https://github.com/apache/camel-quarkus/pull/478#discussion_r351239857
 
 

 ##########
 File path: integration-tests/fhir/src/main/java/org/apache/camel/quarkus/component/fhir/it/FhirR5Resource.java
 ##########
 @@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.fhir.it;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.InputStream;
+import java.net.URI;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import org.apache.camel.ProducerTemplate;
+
+@Path("/r5")
+@ApplicationScoped
+public class FhirR5Resource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/fhir2json")
+    @POST
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_OCTET_STREAM)
+    public Response fhir2json(String patient) throws Exception {
+        InputStream response = producerTemplate.requestBody("direct:json-to-r5", patient,
InputStream.class);
+        return Response
+                .created(new URI("https://camel.apache.org/"))
+                .entity(response)
+                .build();
+    }
+
+    @Path("/fhir2xml")
+    @POST
+    @Consumes(MediaType.APPLICATION_XML)
+    @Produces(MediaType.APPLICATION_OCTET_STREAM)
+    public Response fhir2xml(String patient) throws Exception {
+        InputStream response = producerTemplate.requestBody("direct:xml-to-r5", patient,
InputStream.class);
 
 Review comment:
   Done. Thanks !

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message