View Javadoc
1   /*
2    * Copyright 2012 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.core.atna.custom;
17  
18  import org.openhealthtools.ihe.atna.auditor.codes.dicom.DICOMEventIdCodes;
19  import org.openhealthtools.ihe.atna.auditor.codes.ihe.IHETransactionEventTypeCodes;
20  import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes;
21  import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881ParticipantObjectCodes;
22  import org.openhealthtools.ihe.atna.auditor.events.ihe.GenericIHEAuditEventMessage;
23  import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType;
24  import org.openhealthtools.ihe.atna.auditor.models.rfc3881.TypeValuePairType;
25  import org.openhealthtools.ihe.atna.auditor.utils.EventUtils;
26  
27  import java.nio.charset.Charset;
28  import java.util.LinkedList;
29  import java.util.List;
30  
31  /**
32   * ATNA Audit event for RAD-69 and RAD-75.
33   * @author Dmytro Rud
34   *
35   * @deprecated
36   */
37  public class ImagingRetrieveEvent extends GenericIHEAuditEventMessage {
38  
39      public ImagingRetrieveEvent(
40              boolean systemIsSource,
41              RFC3881EventCodes.RFC3881EventOutcomeCodes outcome,
42              IHETransactionEventTypeCodes eventType,
43              List<CodedValueType> purposesOfUse)
44      {
45          super(systemIsSource,
46                outcome,
47                systemIsSource ? RFC3881EventCodes.RFC3881EventActionCodes.CREATE : RFC3881EventCodes.RFC3881EventActionCodes.READ,
48                systemIsSource ? new DICOMEventIdCodes.Import() : new DICOMEventIdCodes.Export(),
49                eventType,
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 addDocumentParticipantObject(
62              String studyInstanceUniqueId,
63              String seriesInstanceUniqueId,
64              String documentUniqueId,
65              String repositoryUniqueId,
66              String homeCommunityId)
67      {
68          List<TypeValuePairType> pairs = new LinkedList<>();
69          addTypeValuePair(pairs, "Study Instance Unique Id",  studyInstanceUniqueId);
70          addTypeValuePair(pairs, "Series Instance Unique Id", seriesInstanceUniqueId);
71          addTypeValuePair(pairs, "Repository Unique Id",      repositoryUniqueId);
72          addTypeValuePair(pairs, "ihe:homeCommunityID",       homeCommunityId);
73  
74          addParticipantObjectIdentification(
75                  new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.ReportNumber(),
76                  null,
77                  null,
78                  pairs,
79                  documentUniqueId,
80                  RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectTypeCodes.SYSTEM,
81                  RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectTypeRoleCodes.REPORT,
82                  null,
83                  null);
84      }
85  
86  }