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.hl7v2;
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.IntegrationProfile;
23  import org.openehealth.ipf.commons.ihe.core.InteractionId;
24  import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti64.Iti64AuditDataset;
25  import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti64.Iti64AuditStrategy;
26  import org.openehealth.ipf.commons.ihe.hl7v2.definitions.CustomModelClassUtils;
27  import org.openehealth.ipf.commons.ihe.hl7v2.definitions.HapiContextFactory;
28  import org.openehealth.ipf.gazelle.validation.profile.pixpdq.PixPdqTransactions;
29  
30  import java.util.Arrays;
31  import java.util.List;
32  
33  /**
34   * @author Christian Ohr
35   * @since 3.2
36   */
37  public class XPID implements IntegrationProfile {
38  
39      @AllArgsConstructor
40      public enum Interactions implements Hl7v2InteractionId<Iti64AuditDataset> {
41          ITI_64(ITI_64_CONFIGURATION, ITI_64_NAK_FACTORY);
42  
43          @Getter private Hl7v2TransactionConfiguration<Iti64AuditDataset> hl7v2TransactionConfiguration;
44          @Getter private NakFactory<Iti64AuditDataset> nakFactory;
45      }
46  
47      @Override
48      public List<InteractionId> getInteractionIds() {
49          return Arrays.asList(Interactions.values());
50      }
51  
52      private static final Hl7v2TransactionConfiguration<Iti64AuditDataset> ITI_64_CONFIGURATION =
53              new Hl7v2TransactionConfiguration<>(
54                      "xpid-iti64",
55                      "XAD-PID Change Management",
56                      false,
57                      new Iti64AuditStrategy(false),
58                      new Iti64AuditStrategy(true),
59                      new Version[] {Version.V25},
60                      "XPID adapter",
61                      "IPF",
62                      ErrorCode.APPLICATION_INTERNAL_ERROR,
63                      ErrorCode.APPLICATION_INTERNAL_ERROR,
64                      new String[] {"ADT"},
65                      new String[] {"A43"},
66                      new String[] {"ACK"},
67                      new String[] {"*"},
68                      new boolean[] {true},
69                      new boolean[] {false},
70                      HapiContextFactory.createHapiContext(
71                              CustomModelClassUtils.createFactory("xpid", "2.5"),
72                              PixPdqTransactions.ITI64));
73  
74      private static final NakFactory ITI_64_NAK_FACTORY = new NakFactory(ITI_64_CONFIGURATION);
75  }