View Javadoc
1   /*
2    * Copyright 2015 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.xds.dispatch;
17  
18  import org.apache.cxf.interceptor.Fault;
19  import org.apache.cxf.message.Message;
20  import org.openehealth.ipf.commons.ihe.ws.cxf.payload.InPayloadExtractorInterceptor;
21  import org.openehealth.ipf.commons.ihe.ws.cxf.payload.StringPayloadHolder;
22  
23  import javax.xml.namespace.QName;
24  import java.util.HashSet;
25  import java.util.Set;
26  
27  /**
28   * @author Dmytro Rud
29   */
30  public class DispatchInPayloadExtractorInterceptor extends InPayloadExtractorInterceptor {
31      private final static Set<QName> SET = new HashSet<>();
32      static {
33          SET.add(new QName("urn:ihe:iti:xds-b:2007", "DocumentRegistry_RegistryStoredQuery"));
34          SET.add(new QName("urn:ihe:iti:xds-b:2007", "RespondingGateway_CrossGatewayQuery"));
35          SET.add(new QName("urn:ihe:iti:xds-b:2007", "DocumentRegistry_MultiPatientStoredQuery"));
36          SET.add(new QName("urn:ihe:iti:xds-b:2007", "RespondingGateway_CrossGatewayFetch"));
37      }
38  
39  
40      public DispatchInPayloadExtractorInterceptor() {
41          super(StringPayloadHolder.PayloadType.SOAP_BODY);
42      }
43  
44      @Override
45      public void handleMessage(Message message) throws Fault {
46  
47          // TODO: find a way for choosing whether payload collecting is necessary or not
48          /*
49          if (! message.containsKey(MessageContext.WSDL_OPERATION)) {
50              return;
51          }
52  
53          QName operationName = (QName) message.get(MessageContext.WSDL_OPERATION);
54          if (SET.contains(operationName)) {
55              super.handleMessage(message);
56          }
57          */
58  
59          super.handleMessage(message);
60      }
61  }