1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.AuditException;
23 import org.openehealth.ipf.commons.audit.codes.ParticipantObjectDataLifeCycle;
24 import org.openehealth.ipf.commons.audit.codes.ParticipantObjectIdTypeCode;
25 import org.openehealth.ipf.commons.audit.codes.ParticipantObjectTypeCode;
26 import org.openehealth.ipf.commons.audit.codes.ParticipantObjectTypeCodeRole;
27 import org.openehealth.ipf.commons.audit.types.ParticipantObjectIdType;
28
29 import java.io.Serializable;
30 import java.util.ArrayList;
31 import java.util.List;
32
33 import static java.util.Objects.requireNonNull;
34
35
36
37
38
39 @EqualsAndHashCode
40 public class ParticipantObjectIdentificationType implements Serializable, Validateable {
41
42
43
44
45 @Getter
46 @Setter
47 @NonNull
48 private String participantObjectID;
49
50
51
52
53 @Getter
54 @Setter
55 @NonNull
56 private ParticipantObjectIdType participantObjectIDTypeCode;
57
58
59
60
61 @Getter
62 @Setter
63 private String participantObjectName;
64
65
66
67
68 @Getter
69 @Setter
70 private byte[] participantObjectQuery;
71
72
73
74
75
76 @Getter
77 @Setter
78 private ParticipantObjectTypeCode participantObjectTypeCode;
79
80
81
82
83
84
85
86 @Getter
87 @Setter
88 private ParticipantObjectTypeCodeRole participantObjectTypeCodeRole;
89
90
91
92
93
94 @Getter
95 @Setter
96 private ParticipantObjectDataLifeCycle participantObjectDataLifeCycle;
97
98
99
100
101
102 @Getter
103 @Setter
104 private String participantObjectSensitivity;
105
106 private List<TypeValuePairType> participantObjectDetails;
107
108 private List<DicomObjectDescriptionType> participantObjectDescriptions;
109
110
111
112
113
114
115 public ParticipantObjectIdentificationType(String participantObjectID, ParticipantObjectIdType participantObjectIDTypeCode) {
116 this.participantObjectID = requireNonNull(participantObjectID, "participantObjectID must be not null");
117 this.participantObjectIDTypeCode = requireNonNull(participantObjectIDTypeCode, "participantObjectIDTypeCode must be not null");
118 }
119
120
121
122
123
124
125
126
127 public List<TypeValuePairType> getParticipantObjectDetails() {
128 if (participantObjectDetails == null) {
129 participantObjectDetails = new ArrayList<>();
130 }
131 return this.participantObjectDetails;
132 }
133
134 public List<DicomObjectDescriptionType> getParticipantObjectDescriptions() {
135 if (participantObjectDescriptions == null) {
136 participantObjectDescriptions = new ArrayList<>();
137 }
138 return this.participantObjectDescriptions;
139 }
140
141
142
143
144
145
146
147 @Override
148 public void validate() {
149 if (participantObjectIDTypeCode == ParticipantObjectIdTypeCode.StudyInstanceUID &&
150 participantObjectDescriptions.isEmpty())
151 throw new AuditException("DICOM Object Descriptions must be present for StudyInstanceUID participant object ID types");
152 }
153 }