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  package org.openehealth.ipf.commons.ihe.hl7v2ws;
17  
18  import ca.uhn.hl7v2.ErrorCode;
19  import ca.uhn.hl7v2.Version;
20  import lombok.AllArgsConstructor;
21  import lombok.Getter;
22  import org.openehealth.ipf.commons.ihe.core.InteractionId;
23  import org.openehealth.ipf.commons.ihe.core.IntegrationProfile;
24  import org.openehealth.ipf.commons.ihe.hl7v2.Hl7v2TransactionConfiguration;
25  import org.openehealth.ipf.commons.ihe.hl7v2.NakFactory;
26  import org.openehealth.ipf.commons.ihe.hl7v2.audit.MllpAuditDataset;
27  import org.openehealth.ipf.commons.ihe.hl7v2.definitions.HapiContextFactory;
28  import org.openehealth.ipf.commons.ihe.hl7v2ws.pcd01.Pcd01PortType;
29  import org.openehealth.ipf.commons.ihe.ws.WsTransactionConfiguration;
30  import org.openehealth.ipf.commons.ihe.ws.cxf.audit.WsAuditDataset;
31  import org.openehealth.ipf.gazelle.validation.profile.pcd.PcdTransactions;
32  
33  import javax.xml.namespace.QName;
34  import java.util.Arrays;
35  import java.util.List;
36  
37  /**
38   * @author Christian Ohr
39   * @since 3.2
40   */
41  public class PCD implements IntegrationProfile {
42  
43      @AllArgsConstructor
44      public enum Interactions implements Hl7v2WsInteractionId {
45          PCD_01(PCD_01_HL7V2_CONFIG, PCD_01_NAK_FACTORY, PCD_01_WS_CONFIG);
46  
47          @Getter private Hl7v2TransactionConfiguration<MllpAuditDataset> hl7v2TransactionConfiguration;
48          @Getter private NakFactory<MllpAuditDataset> nakFactory;
49          @Getter private WsTransactionConfiguration<WsAuditDataset> wsTransactionConfiguration;
50      }
51  
52      @Override
53      public List<InteractionId> getInteractionIds() {
54          return Arrays.asList(Interactions.values());
55      }
56  
57      private static final String NS_URI = "urn:ihe:pcd:dec:2010";
58      private static final WsTransactionConfiguration<WsAuditDataset> PCD_01_WS_CONFIG = new WsTransactionConfiguration<>(
59              "pcd-pcd01",
60              "Communicate PCD Data",
61              false,
62              null,
63              null,
64              new QName(NS_URI, "DeviceObservationConsumer_Service", "ihe"),
65              Pcd01PortType.class,
66              new QName(NS_URI, "DeviceObservationConsumer_Binding_Soap12", "ihe"),
67              false,
68              "wsdl/pcd01/pcd01.wsdl",
69              true,
70              false,
71              false,
72              false);
73  
74      private static final Hl7v2TransactionConfiguration<MllpAuditDataset> PCD_01_HL7V2_CONFIG = new Hl7v2TransactionConfiguration<>(
75              "pcd-pcd01",
76              "Communicate PCD Data",
77              false,
78              null,
79              null,
80              new Version[] {Version.V26},
81              "PCD01",
82              "IPF",
83              ErrorCode.APPLICATION_INTERNAL_ERROR,
84              ErrorCode.APPLICATION_INTERNAL_ERROR,
85              new String[] {"ORU"},
86              new String[] {"R01"},
87              new String[] {"ACK"},
88              new String[] {"*"},
89              null,
90              null,
91              HapiContextFactory.createHapiContext(PcdTransactions.PCD1));
92  
93      private static final NakFactory<MllpAuditDataset> PCD_01_NAK_FACTORY = new NakFactory<>(PCD_01_HL7V2_CONFIG, false, "ACK^R01^ACK");
94  }