View Javadoc
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.ihe.xds.iti80;
17  
18  import org.openehealth.ipf.commons.ihe.xds.core.audit.XdsSubmitAuditDataset;
19  import org.openehealth.ipf.commons.ihe.xds.core.audit.XdsSubmitAuditStrategy30;
20  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLSubmitObjectsRequest;
21  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.EbXMLSubmitObjectsRequest30;
22  import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.ProvideAndRegisterDocumentSetRequestType;
23  import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest;
24  
25  import java.util.Map;
26  
27  /**
28   * Audit strategy for ITI-80.
29   * @author Remco Overdevest
30   * @since 3.3
31   */
32  abstract class Iti80AuditStrategy extends XdsSubmitAuditStrategy30 {
33  
34      /**
35       * Constructs the audit strategy.
36       * @param serverSide
37       *      whether this is a server-side or a client-side strategy.
38       */
39      public Iti80AuditStrategy(boolean serverSide) {
40          super(serverSide);
41      }
42  
43      @Override
44      public XdsSubmitAuditDataset enrichAuditDatasetFromRequest(XdsSubmitAuditDataset auditDataset, Object pojo, Map<String, Object> parameters) {
45          ProvideAndRegisterDocumentSetRequestType request = (ProvideAndRegisterDocumentSetRequestType)pojo;
46          SubmitObjectsRequest submitObjectsRequest = request.getSubmitObjectsRequest();
47          if (submitObjectsRequest != null) {
48              EbXMLSubmitObjectsRequest ebXML = new EbXMLSubmitObjectsRequest30(submitObjectsRequest);
49              enrichDatasetFromSubmitObjectsRequest(auditDataset, ebXML);
50          }
51          return auditDataset;
52      }
53  
54  }