1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.openehealth.ipf.commons.ihe.hpd.iti59;
18
19 import org.apache.commons.lang3.StringUtils;
20 import org.openehealth.ipf.commons.audit.AuditContext;
21 import org.openehealth.ipf.commons.audit.codes.ParticipantObjectTypeCodeRole;
22 import org.openehealth.ipf.commons.audit.model.AuditMessage;
23 import org.openehealth.ipf.commons.audit.model.TypeValuePairType;
24 import org.openehealth.ipf.commons.ihe.core.atna.event.PHIImportBuilder;
25 import org.openehealth.ipf.commons.ihe.hpd.audit.codes.HpdEventTypeCode;
26 import org.openehealth.ipf.commons.ihe.hpd.audit.codes.HpdParticipantObjectIdTypeCode;
27
28 import java.util.Collections;
29 import java.util.List;
30
31
32
33
34 public class Iti59ServerAuditStrategy extends Iti59AuditStrategy {
35
36 public Iti59ServerAuditStrategy() {
37 super(true);
38 }
39
40 protected AuditMessage makeAuditMessage(AuditContext auditContext, Iti59AuditDataset auditDataset, Iti59AuditDataset.RequestItem requestItem) {
41 PHIImportBuilder builder = new PHIImportBuilder<>(
42 auditContext,
43 auditDataset,
44 requestItem.getOutcomeCode(),
45 requestItem.getOutcomeDescription(),
46 requestItem.getActionCode(),
47 HpdEventTypeCode.ProviderInformationFeed,
48 auditDataset.getPurposesOfUse());
49
50 List<TypeValuePairType> details = StringUtils.isBlank(requestItem.getNewUid())
51 ? Collections.emptyList()
52 : Collections.singletonList(new TypeValuePairType("new uid", requestItem.getNewUid()));
53
54 builder.addImportedEntity(
55 requestItem.getUid(),
56 HpdParticipantObjectIdTypeCode.RelativeDistinguishedName,
57 requestItem.getParticipantObjectTypeCode(),
58 ParticipantObjectTypeCodeRole.Provider,
59 details);
60
61 return builder.getMessage();
62 }
63 }