View Javadoc
1   /*
2    * Copyright 2009 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.xds.core.audit;
17  
18  import lombok.Getter;
19  import org.openehealth.ipf.commons.ihe.ws.cxf.audit.WsAuditDataset;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  /**
25   * A data structure that contains XDS-specific ATNA audit information pieces
26   * in addition to common IHE Web Service-related ones.
27   *
28   * @author Dmytro Rud
29   */
30  abstract public class XdsAuditDataset extends WsAuditDataset {
31  
32      private static final long serialVersionUID = 652866992858926778L;
33  
34      // patient ID as HL7 CX datatype, e.g. "1234^^^&1.2.3.4&ISO"
35      @Getter
36      private final List<String> patientIds = new ArrayList<>();
37  
38      public XdsAuditDataset(boolean serverSide) {
39          super(serverSide);
40      }
41  
42      /**
43       * @return the first present patient ID as HL7 CX string, e.g. "1234^^^&1.2.3.4&ISO",
44       * or the patient ID extracted from XUA token,
45       * or <code>null</code> when no patient IDs have been collected.
46       */
47      public String getPatientId() {
48          return patientIds.isEmpty() ? getXuaPatientId() : patientIds.get(0);
49      }
50  }