1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.core.atna.custom;
17
18 import org.openhealthtools.ihe.atna.auditor.codes.dicom.DICOMEventIdCodes;
19 import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes;
20 import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881ParticipantObjectCodes;
21 import org.openhealthtools.ihe.atna.auditor.events.ihe.GenericIHEAuditEventMessage;
22 import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType;
23 import org.openhealthtools.ihe.atna.auditor.models.rfc3881.TypeValuePairType;
24 import org.openhealthtools.ihe.atna.auditor.utils.EventUtils;
25
26 import java.nio.charset.Charset;
27 import java.util.LinkedList;
28 import java.util.List;
29
30
31
32
33
34
35
36
37
38 public class RemoveDocumentsEvent extends GenericIHEAuditEventMessage {
39
40 public RemoveDocumentsEvent(
41 boolean systemIsSource,
42 RFC3881EventCodes.RFC3881EventOutcomeCodes outcome,
43 List<CodedValueType> purposesOfUse)
44 {
45 super(systemIsSource,
46 outcome,
47 RFC3881EventCodes.RFC3881EventActionCodes.DELETE,
48 new DICOMEventIdCodes.PatientRecord(),
49 new CustomIHETransactionEventTypeCodes.RemoveDocuments(),
50 purposesOfUse);
51 }
52
53
54 protected void addTypeValuePair(List<TypeValuePairType> pairs, String type, String value) {
55 if (! EventUtils.isEmptyOrNull(value)) {
56 pairs.add(getTypeValuePair(type, value.getBytes(Charset.defaultCharset())));
57 }
58 }
59
60
61 public void addRemovedDocumentParticipantObject(String documentUniqueId, String repositoryUniqueId) {
62 List<TypeValuePairType> pairs = new LinkedList<>();
63 addTypeValuePair(pairs, "urn:ihe:iti:xds:2007:repositoryUniqueId", repositoryUniqueId);
64
65 addParticipantObjectIdentification(
66 new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
67 null,
68 null,
69 pairs,
70 documentUniqueId,
71 RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectTypeCodes.SYSTEM,
72 RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectTypeRoleCodes.REPORT,
73 RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectDataLifeCycleCodes.PERMANENT_ERASURE,
74 null);
75 }
76
77 }