1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.hl7v3;
17
18 import org.apache.cxf.endpoint.Client;
19 import org.apache.cxf.feature.AbstractFeature;
20 import org.apache.cxf.interceptor.InterceptorProvider;
21 import org.openehealth.ipf.commons.audit.AuditContext;
22 import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
23 import org.openehealth.ipf.commons.ihe.hl7v3.audit.Hl7v3AuditDataset;
24 import org.openehealth.ipf.commons.ihe.ws.JaxWsClientFactory;
25 import org.openehealth.ipf.commons.ihe.ws.cxf.audit.AuditResponseInterceptor;
26 import org.openehealth.ipf.commons.ihe.ws.cxf.databinding.plainxml.PlainXmlDataBinding;
27
28 import java.util.List;
29 import java.util.Map;
30
31
32
33
34
35
36 public class Hl7v3DeferredResponderFactory extends JaxWsClientFactory<Hl7v3AuditDataset> {
37
38 public Hl7v3DeferredResponderFactory(
39 Hl7v3WsTransactionConfiguration wsTransactionConfiguration,
40 String serviceUrl,
41 AuditStrategy<Hl7v3AuditDataset> auditStrategy,
42 AuditContext auditContext,
43 InterceptorProvider customInterceptors,
44 List<AbstractFeature> features,
45 Map<String, Object> properties)
46 {
47 super(wsTransactionConfiguration, serviceUrl, auditStrategy, auditContext,
48 customInterceptors, features, properties, null);
49 }
50
51
52 @Override
53 protected void configureInterceptors(Client client) {
54 super.configureInterceptors(client);
55 client.getEndpoint().getService().setDataBinding(new PlainXmlDataBinding());
56
57 if (auditStrategy != null) {
58 AuditResponseInterceptor<Hl7v3AuditDataset> auditInterceptor =
59 new AuditResponseInterceptor<>(auditStrategy, auditContext, true, null, false);
60 client.getOutInterceptors().add(auditInterceptor);
61 client.getOutFaultInterceptors().add(auditInterceptor);
62 }
63 }
64 }