1 /*
2 * Copyright 2017 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.audit.model;
17
18 import lombok.EqualsAndHashCode;
19 import lombok.Getter;
20 import lombok.NonNull;
21 import lombok.Setter;
22 import org.openehealth.ipf.commons.audit.types.AuditSource;
23
24 import java.io.Serializable;
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import static java.util.Objects.requireNonNull;
29
30 /**
31 * @author Christian Ohr
32 * @since 3.5
33 */
34 @EqualsAndHashCode
35 public class AuditSourceIdentificationType implements Serializable, Validateable {
36
37 /**
38 * Identifier of the source that detected the auditable event and created this audit message.
39 * Although often the audit source is one of the participants, it could also be an external system
40 * that is monitoring the activities of the participants (e.g., an add-on audit-generating device).
41 */
42 @Getter @Setter @NonNull
43 private String auditSourceID;
44
45 /**
46 * <p>
47 * Logical source location within the healthcare enterprise network,
48 * e.g., a hospital or other provider location within a multi-entity provider group.
49 * </p>
50 * <p>
51 * Serves to further qualify the Audit Source ID, since Audit Source ID is not required to be globally unique.
52 * </p>
53 */
54 @Getter @Setter
55 private String auditEnterpriseSiteID;
56
57 private List<AuditSource> auditSourceTypeCode;
58
59 /**
60 * @param auditSourceID identifier of the source that detected the auditable event and created this audit message
61 */
62 public AuditSourceIdentificationType(String auditSourceID) {
63 this.auditSourceID = requireNonNull(auditSourceID, "auditSourceID must be not null");
64 }
65
66 /**
67 * Code specifying the type of source. The Audit Source Type Code values specify the type of source where an event originated.
68 * Codes from coded terminologies and implementation defined codes can also be used for the AuditSourceTypeCode.
69 *
70 * @return codes specifying the type of source
71 */
72 public List<AuditSource> getAuditSourceType() {
73 if (auditSourceTypeCode == null) {
74 auditSourceTypeCode = new ArrayList<>();
75 }
76 return this.auditSourceTypeCode;
77 }
78
79 @Override
80 public void validate() {
81 // no special rules
82 }
83 }