1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.ihe.hl7v3.iti44;
17
18 import org.openehealth.ipf.commons.ihe.hl7v3.audit.Hl7v3AuditDataset;
19 import org.openehealth.ipf.commons.ihe.hl7v3.Hl7v3WsTransactionConfiguration;
20 import org.openehealth.ipf.commons.ihe.hl7v3.iti44.GenericIti44PortType;
21 import org.openehealth.ipf.commons.ihe.ws.JaxWsClientFactory;
22 import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWsEndpoint;
23 import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWsProducer;
24
25 import static org.openehealth.ipf.commons.xml.XmlUtils.rootElementName;
26
27
28
29
30 public class Iti44Producer extends AbstractWsProducer<Hl7v3AuditDataset, Hl7v3WsTransactionConfiguration, String, String> {
31
32
33
34
35
36
37
38 public Iti44Producer(AbstractWsEndpoint<Hl7v3AuditDataset, Hl7v3WsTransactionConfiguration> endpoint, JaxWsClientFactory<Hl7v3AuditDataset> clientFactory) {
39 super(endpoint, clientFactory, String.class, String.class);
40 }
41
42 @Override
43 protected String callService(Object clientObject, String request) {
44 GenericIti44PortType client = (GenericIti44PortType) clientObject;
45 String rootElementName = rootElementName(request);
46 if ("PRPA_IN201301UV02".equals(rootElementName)) {
47 return client.recordAdded(request);
48 }
49 else if ("PRPA_IN201302UV02".equals(rootElementName)) {
50 return client.recordRevised(request);
51 }
52 else if ("PRPA_IN201304UV02".equals(rootElementName)) {
53 return client.duplicatesResolved(request);
54 }
55 throw new RuntimeException("Cannot dispatch message with root element " + rootElementName);
56 }
57 }