View Javadoc
1   /*
2    * Copyright 2016 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  
17  package org.openehealth.ipf.platform.camel.ihe.fhir.iti68;
18  
19  import org.apache.camel.Endpoint;
20  import org.apache.camel.component.servlet.ServletComponent;
21  import org.apache.camel.http.common.HttpMethods;
22  import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
23  import org.openehealth.ipf.commons.ihe.fhir.mhd.MHD;
24  import org.openehealth.ipf.commons.ihe.fhir.iti68.Iti68AuditDataset;
25  import org.openehealth.ipf.platform.camel.ihe.atna.AuditableComponent;
26  import org.openehealth.ipf.platform.camel.ihe.atna.AuditableEndpointConfiguration;
27  import org.openehealth.ipf.platform.camel.ihe.core.InterceptableComponent;
28  import org.openehealth.ipf.platform.camel.ihe.core.Interceptor;
29  
30  import java.net.URI;
31  import java.util.Collections;
32  import java.util.List;
33  import java.util.Map;
34  
35  /**
36   * Component for MHD Retrieve Document (ITI-68)
37   *
38   * @author Christian Ohr
39   * @since 3.4
40   */
41  public class Iti68Component extends ServletComponent implements InterceptableComponent, AuditableComponent<Iti68AuditDataset> {
42  
43      public Iti68Component() {
44          super(Iti68Endpoint.class);
45      }
46  
47  
48      @Override
49      protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
50          Iti68Endpoint endpoint = (Iti68Endpoint)super.createEndpoint(uri, remaining, parameters);
51          // Ensure that the audit/auditContext parameter is evaluated
52          endpoint.setConfig(new AuditableEndpointConfiguration(this, parameters));
53          return endpoint;
54      }
55  
56      @Override
57      protected Iti68Endpoint createServletEndpoint(String endpointUri, ServletComponent component, URI httpUri) throws Exception {
58          Iti68Endpoint endpoint = new Iti68Endpoint(endpointUri, component, httpUri);
59          endpoint.setHttpMethodRestrict(HttpMethods.GET.name());
60          return endpoint;
61      }
62  
63      @Override
64      protected boolean lenientContextPath() {
65          return false;
66      }
67  
68      @Override
69      public List<Interceptor<?>> getAdditionalConsumerInterceptors() {
70          return Collections.emptyList();
71      }
72  
73      @Override
74      public List<Interceptor<?>> getAdditionalProducerInterceptors() {
75          return Collections.emptyList();
76      }
77  
78      @Override
79      public AuditStrategy<Iti68AuditDataset> getClientAuditStrategy() {
80          return MHD.RetrieveInteractions.ITI_68.getTransactionConfiguration().getClientAuditStrategy();
81      }
82  
83      @Override
84      public AuditStrategy<Iti68AuditDataset> getServerAuditStrategy() {
85          return MHD.RetrieveInteractions.ITI_68.getTransactionConfiguration().getServerAuditStrategy();
86      }
87  }