View Javadoc
1   /*
2    * Copyright 2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.platform.camel.ihe.hl7v3.iti56;
17  
18  import lombok.extern.slf4j.Slf4j;
19  import org.apache.camel.Exchange;
20  import org.apache.cxf.interceptor.Fault;
21  import org.openehealth.ipf.commons.ihe.hl7v3.iti56.Iti56PortType;
22  import org.openehealth.ipf.platform.camel.core.util.Exchanges;
23  import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWebService;
24  
25  /**
26   * Service implementation for the IHE ITI-56 transaction (XCPD).
27   * @author Dmytro Rud
28   */
29  @Slf4j
30  public class Iti56Service extends AbstractWebService implements Iti56PortType {
31  
32      @Override
33      public String locatePatients(String request) {
34          Exchange result = process(request);
35          Exception exception = Exchanges.extractException(result);
36          if (exception != null) {
37              log.debug("ITI-56 service failed", exception);
38              throw new Fault(exception);
39          }
40          
41          return Exchanges.resultMessage(result).getBody(String.class);
42      }
43  
44  }