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.HapiContext;
20  import ca.uhn.hl7v2.Version;
21  import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
22  import org.openehealth.ipf.commons.ihe.hl7v2.audit.QueryAuditDataset;
23  
24  import java.util.List;
25  
26  /**
27   * A MLLP transaction configuration with PDQ-specific methods for continuation support.
28   *
29   * @author Dmytro Rud
30   */
31  public class PdqTransactionConfiguration extends Hl7v2TransactionConfiguration<QueryAuditDataset> {
32     
33      public PdqTransactionConfiguration(
34              String name,
35              String description,
36              boolean isQuery,
37              AuditStrategy<QueryAuditDataset> clientAuditStrategy,
38              AuditStrategy<QueryAuditDataset> serverAuditStrategy,
39              Version[] hl7Version,
40              String sendingApplication, 
41              String sendingFacility,
42              ErrorCode requestErrorDefaultErrorCode,
43              ErrorCode responseErrorDefaultErrorCode,
44              String[] allowedRequestMessageTypes,
45              String[] allowedRequestTriggerEvents,
46              String[] allowedResponseMessageTypes,
47              String[] allowedResponseTriggerEvents, 
48              boolean[] auditabilityFlags,
49              boolean[] responseContinuabilityFlags,
50              HapiContext hapiContext)
51      {
52          super(name, description, isQuery, clientAuditStrategy, serverAuditStrategy,
53                  hl7Version, sendingApplication, sendingFacility,
54                  requestErrorDefaultErrorCode,
55                  responseErrorDefaultErrorCode, allowedRequestMessageTypes,
56                  allowedRequestTriggerEvents, allowedResponseMessageTypes,
57                  allowedResponseTriggerEvents, auditabilityFlags,
58                  responseContinuabilityFlags, hapiContext);
59      }
60      
61      @Override
62      public boolean isDataStartSegment(List<String> segments, int index) {
63          return segments.get(index).startsWith("PID");
64      }
65  
66      @Override
67      public boolean isFooterStartSegment(List<String> segments, int index) {
68          return segments.get(index).startsWith("DSC");
69      }
70  }