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.platform.camel.ihe.hpd;
17  
18  import org.apache.camel.Processor;
19  import org.openehealth.ipf.commons.ihe.hpd.HpdValidator;
20  import org.openehealth.ipf.commons.ihe.hpd.stub.chpidd.DownloadRequest;
21  import org.openehealth.ipf.commons.ihe.hpd.stub.chpidd.DownloadResponse;
22  import org.openehealth.ipf.commons.ihe.hpd.stub.dsmlv2.BatchRequest;
23  import org.openehealth.ipf.commons.ihe.hpd.stub.dsmlv2.BatchResponse;
24  
25  /**
26   * @author Dmytro Rud
27   */
28  public class HpdCamelValidators {
29  
30      private static final Processor ITI_58_REQUEST_VALIDATOR = exchange -> {
31          BatchRequest request = exchange.getIn().getMandatoryBody(BatchRequest.class);
32          new HpdValidator().validateBatchRequest(request);
33      };
34  
35      private static final Processor ITI_58_RESPONSE_VALIDATOR = exchange -> {
36          BatchResponse response = exchange.getIn().getMandatoryBody(BatchResponse.class);
37          new HpdValidator().validateBatchResponse(response);
38      };
39  
40      private static final Processor ITI_59_REQUEST_VALIDATOR = exchange -> {
41          // TODO
42      };
43  
44      private static final Processor ITI_59_RESPONSE_VALIDATOR = exchange -> {
45          // TODO
46      };
47  
48      private static final Processor CH_PIDD_REQUEST_VALIDATOR = exchange -> {
49          DownloadRequest request = exchange.getIn().getMandatoryBody(DownloadRequest.class);
50          new HpdValidator().validateDownloadRequest(request);
51      };
52  
53      private static final Processor CH_PIDD_RESPONSE_VALIDATOR = exchange -> {
54          DownloadResponse response = exchange.getIn().getMandatoryBody(DownloadResponse.class);
55          new HpdValidator().validateDownloadResponse(response);
56      };
57  
58      public static Processor iti58RequestValidator() {
59          return ITI_58_REQUEST_VALIDATOR;
60      }
61  
62      public static Processor iti58ResponseValidator() {
63          return ITI_58_RESPONSE_VALIDATOR;
64      }
65  
66      public static Processor iti59RequestValidator() {
67          return ITI_59_REQUEST_VALIDATOR;
68      }
69  
70      public static Processor iti59ResponseValidator() {
71          return ITI_59_RESPONSE_VALIDATOR;
72      }
73  
74      public static Processor chPiddRequestValidator() {
75          return CH_PIDD_REQUEST_VALIDATOR;
76      }
77  
78      public static Processor chPiddResponseValidator() {
79          return CH_PIDD_RESPONSE_VALIDATOR;
80      }
81  
82  }