1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.ihe.xds;
17
18 import org.apache.camel.Processor;
19 import org.openehealth.ipf.commons.ihe.xds.XCMU;
20 import org.openehealth.ipf.commons.ihe.xds.XDM;
21 import org.openehealth.ipf.commons.ihe.xds.XDR;
22 import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.*;
23 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.RemoveObjectsRequest;
24 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.lcm.SubmitObjectsRequest;
25 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryRequest;
26 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryResponse;
27 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryResponseType;
28 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.AdhocQueryRequestValidator;
29 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.ProvideAndRegisterDocumentSetRequestValidator;
30 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.RemoveMetadataRequestValidator;
31 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.NonconstructiveDocumentSetRequestValidator;
32 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.RetrieveImagingDocumentSetRequestValidator;
33 import org.openehealth.ipf.commons.ihe.xds.core.validate.requests.SubmitObjectsRequestValidator;
34 import org.openehealth.ipf.commons.ihe.xds.core.validate.responses.QueryResponseValidator;
35 import org.openehealth.ipf.commons.ihe.xds.core.validate.responses.RegistryResponseValidator;
36 import org.openehealth.ipf.commons.ihe.xds.core.validate.responses.RetrieveDocumentSetResponseValidator;
37
38 import static org.openehealth.ipf.commons.ihe.xds.RAD.Interactions.RAD_69;
39 import static org.openehealth.ipf.commons.ihe.xds.RAD.Interactions.RAD_75;
40 import static org.openehealth.ipf.commons.ihe.xds.XCA.Interactions.ITI_38;
41 import static org.openehealth.ipf.commons.ihe.xds.XCA.Interactions.ITI_39;
42 import static org.openehealth.ipf.commons.ihe.xds.XCF.Interactions.ITI_63;
43 import static org.openehealth.ipf.commons.ihe.xds.XDS.Interactions.*;
44 import static org.openehealth.ipf.platform.camel.core.adapter.ValidatorAdapter.validationEnabled;
45
46
47
48
49
50
51
52 public abstract class XdsCamelValidators {
53
54 private static final Processor ITI_18_REQUEST_VALIDATOR = exchange -> {
55 if (! validationEnabled(exchange)) {
56 return;
57 }
58 EbXMLAdhocQueryRequest30 message =
59 new EbXMLAdhocQueryRequest30(exchange.getIn().getBody(AdhocQueryRequest.class));
60 new AdhocQueryRequestValidator().validate(message, ITI_18);
61 };
62
63 private static final Processor ITI_18_RESPONSE_VALIDATOR = exchange -> {
64 if (! validationEnabled(exchange)) {
65 return;
66 }
67 EbXMLQueryResponse30 message =
68 new EbXMLQueryResponse30(exchange.getIn().getBody(AdhocQueryResponse.class));
69 new QueryResponseValidator().validate(message, ITI_18);
70 };
71
72 private static final Processor ITI_38_REQUEST_VALIDATOR = exchange -> {
73 if (! validationEnabled(exchange)) {
74 return;
75 }
76 EbXMLAdhocQueryRequest30 message =
77 new EbXMLAdhocQueryRequest30(exchange.getIn().getBody(AdhocQueryRequest.class));
78 new AdhocQueryRequestValidator().validate(message, ITI_38);
79 };
80
81 private static final Processor ITI_38_RESPONSE_VALIDATOR = exchange -> {
82 if (! validationEnabled(exchange)) {
83 return;
84 }
85 EbXMLQueryResponse30 message =
86 new EbXMLQueryResponse30(exchange.getIn().getBody(AdhocQueryResponse.class));
87 new QueryResponseValidator().validate(message, ITI_38);
88 };
89
90 private static final Processor ITI_39_REQUEST_VALIDATOR = exchange -> {
91 if (! validationEnabled(exchange)) {
92 return;
93 }
94 EbXMLNonconstructiveDocumentSetRequest30<RetrieveDocumentSetRequestType> message =
95 new EbXMLNonconstructiveDocumentSetRequest30<>(exchange.getIn().getBody(RetrieveDocumentSetRequestType.class));
96 new NonconstructiveDocumentSetRequestValidator().validate(message, ITI_39);
97 };
98
99 private static final Processor ITI_39_RESPONSE_VALIDATOR = exchange -> {
100 if (! validationEnabled(exchange)) {
101 return;
102 }
103 EbXMLRetrieveDocumentSetResponse30 message =
104 new EbXMLRetrieveDocumentSetResponse30(exchange.getIn().getBody(RetrieveDocumentSetResponseType.class));
105 new RetrieveDocumentSetResponseValidator().validate(message, ITI_39);
106 };
107
108 private static final Processor ITI_41_REQUEST_VALIDATOR = exchange -> {
109 if (! validationEnabled(exchange)) {
110 return;
111 }
112 EbXMLProvideAndRegisterDocumentSetRequest30 message =
113 new EbXMLProvideAndRegisterDocumentSetRequest30(exchange.getIn().getBody(ProvideAndRegisterDocumentSetRequestType.class));
114 new ProvideAndRegisterDocumentSetRequestValidator().validate(message, ITI_41);
115 };
116
117 private static final Processor ITI_41_XDM_REQUEST_VALIDATOR = exchange -> {
118 if (! validationEnabled(exchange)) {
119 return;
120 }
121 EbXMLProvideAndRegisterDocumentSetRequest30 message =
122 new EbXMLProvideAndRegisterDocumentSetRequest30(exchange.getIn().getBody(ProvideAndRegisterDocumentSetRequestType.class));
123 new ProvideAndRegisterDocumentSetRequestValidator().validate(message, XDM.Interactions.ITI_41);
124 };
125
126 private static final Processor ITI_41_XDR_REQUEST_VALIDATOR = exchange -> {
127 if (! validationEnabled(exchange)) {
128 return;
129 }
130 EbXMLProvideAndRegisterDocumentSetRequest30 message =
131 new EbXMLProvideAndRegisterDocumentSetRequest30(exchange.getIn().getBody(ProvideAndRegisterDocumentSetRequestType.class));
132 new ProvideAndRegisterDocumentSetRequestValidator().validate(message, XDR.Interactions.ITI_41);
133 };
134
135 private static final Processor ITI_41_RESPONSE_VALIDATOR = exchange -> {
136 if (! validationEnabled(exchange)) {
137 return;
138 }
139 EbXMLRegistryResponse30 message =
140 new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
141 new RegistryResponseValidator().validate(message, ITI_41);
142 };
143
144 private static final Processor ITI_42_REQUEST_VALIDATOR = exchange -> {
145 if (! validationEnabled(exchange)) {
146 return;
147 }
148 EbXMLSubmitObjectsRequest30 message =
149 new EbXMLSubmitObjectsRequest30(exchange.getIn().getBody(SubmitObjectsRequest.class));
150 new SubmitObjectsRequestValidator().validate(message, ITI_42);
151 };
152
153 private static final Processor ITI_42_RESPONSE_VALIDATOR = exchange -> {
154 if (! validationEnabled(exchange)) {
155 return;
156 }
157 EbXMLRegistryResponse30 message = new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
158 new RegistryResponseValidator().validate(message, ITI_42);
159 };
160
161 private static final Processor ITI_43_REQUEST_VALIDATOR = exchange -> {
162 if (! validationEnabled(exchange)) {
163 return;
164 }
165 EbXMLNonconstructiveDocumentSetRequest30<RetrieveDocumentSetRequestType> message =
166 new EbXMLNonconstructiveDocumentSetRequest30<>(exchange.getIn().getBody(RetrieveDocumentSetRequestType.class));
167 new NonconstructiveDocumentSetRequestValidator().validate(message, ITI_43);
168 };
169
170 private static final Processor ITI_43_RESPONSE_VALIDATOR = exchange -> {
171 if (! validationEnabled(exchange)) {
172 return;
173 }
174 EbXMLRetrieveDocumentSetResponse30 message =
175 new EbXMLRetrieveDocumentSetResponse30(exchange.getIn().getBody(RetrieveDocumentSetResponseType.class));
176 new RetrieveDocumentSetResponseValidator().validate(message, ITI_43);
177 };
178
179 private static final Processor ITI_51_REQUEST_VALIDATOR = exchange -> {
180 if (! validationEnabled(exchange)) {
181 return;
182 }
183 EbXMLAdhocQueryRequest30 message =
184 new EbXMLAdhocQueryRequest30(exchange.getIn().getBody(AdhocQueryRequest.class));
185 new AdhocQueryRequestValidator().validate(message, ITI_51);
186 };
187
188 private static final Processor ITI_51_RESPONSE_VALIDATOR = exchange -> {
189 if (! validationEnabled(exchange)) {
190 return;
191 }
192 EbXMLQueryResponse30 message =
193 new EbXMLQueryResponse30(exchange.getIn().getBody(AdhocQueryResponse.class));
194 new QueryResponseValidator().validate(message, ITI_51);
195 };
196
197 private static final Processor ITI_57_REQUEST_VALIDATOR = exchange -> {
198 if (! validationEnabled(exchange)) {
199 return;
200 }
201 EbXMLSubmitObjectsRequest30 message =
202 new EbXMLSubmitObjectsRequest30(exchange.getIn().getBody(SubmitObjectsRequest.class));
203 new SubmitObjectsRequestValidator().validate(message, ITI_57);
204 };
205
206 private static final Processor ITI_57_RESPONSE_VALIDATOR = exchange -> {
207 if (! validationEnabled(exchange)) {
208 return;
209 }
210 EbXMLRegistryResponse30 message = new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
211 new RegistryResponseValidator().validate(message, ITI_57);
212 };
213
214 private static final Processor ITI_61_REQUEST_VALIDATOR = exchange -> {
215 if (! validationEnabled(exchange)) {
216 return;
217 }
218 EbXMLSubmitObjectsRequest30 message =
219 new EbXMLSubmitObjectsRequest30(exchange.getIn().getBody(SubmitObjectsRequest.class));
220 new SubmitObjectsRequestValidator().validate(message, ITI_61);
221 };
222
223 private static final Processor ITI_61_RESPONSE_VALIDATOR = exchange -> {
224 if (! validationEnabled(exchange)) {
225 return;
226 }
227 EbXMLRegistryResponse30 message = new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
228 new RegistryResponseValidator().validate(message, ITI_61);
229 };
230
231 private static final Processor ITI_62_REQUEST_VALIDATOR = exchange -> {
232 if (! validationEnabled(exchange)) {
233 return;
234 }
235 EbXMLRemoveMetadataRequest30 message =
236 new EbXMLRemoveMetadataRequest30(exchange.getIn().getBody(RemoveObjectsRequest.class));
237 new RemoveMetadataRequestValidator().validate(message, ITI_62);
238 };
239
240 private static final Processor ITI_62_RESPONSE_VALIDATOR = exchange -> {
241 if (! validationEnabled(exchange)) {
242 return;
243 }
244 EbXMLRegistryResponse30 message = new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
245 new RegistryResponseValidator().validate(message, ITI_62);
246 };
247
248 private static final Processor ITI_63_REQUEST_VALIDATOR = exchange -> {
249 if (! validationEnabled(exchange)) {
250 return;
251 }
252 EbXMLAdhocQueryRequest30 message =
253 new EbXMLAdhocQueryRequest30(exchange.getIn().getBody(AdhocQueryRequest.class));
254 new AdhocQueryRequestValidator().validate(message, ITI_63);
255 };
256
257 private static final Processor ITI_63_RESPONSE_VALIDATOR = exchange -> {
258 if (! validationEnabled(exchange)) {
259 return;
260 }
261 EbXMLQueryResponse30 message =
262 new EbXMLQueryResponse30(exchange.getIn().getBody(AdhocQueryResponse.class));
263 new QueryResponseValidator().validate(message, ITI_63);
264 };
265
266 private static final Processor ITI_86_REQUEST_VALIDATOR = exchange -> {
267 if (! validationEnabled(exchange)) {
268 return;
269 }
270 EbXMLNonconstructiveDocumentSetRequest30<RemoveDocumentsRequestType> message =
271 new EbXMLNonconstructiveDocumentSetRequest30<>(exchange.getIn().getBody(RemoveDocumentsRequestType.class));
272 new NonconstructiveDocumentSetRequestValidator().validate(message, ITI_86);
273 };
274
275 private static final Processor ITI_86_RESPONSE_VALIDATOR = exchange -> {
276 if (! validationEnabled(exchange)) {
277 return;
278 }
279 EbXMLRegistryResponse30 message =
280 new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
281 new RegistryResponseValidator().validate(message, ITI_86);
282 };
283
284 private static final Processor CH_XCMU_REQUEST_VALIDATOR = exchange -> {
285 if (! validationEnabled(exchange)) {
286 return;
287 }
288 EbXMLSubmitObjectsRequest30 message =
289 new EbXMLSubmitObjectsRequest30(exchange.getIn().getBody(SubmitObjectsRequest.class));
290 new SubmitObjectsRequestValidator().validate(message, XCMU.Interactions.CH_XCMU);
291 };
292
293 private static final Processor CH_XCMU_RESPONSE_VALIDATOR = exchange -> {
294 if (! validationEnabled(exchange)) {
295 return;
296 }
297 EbXMLRegistryResponse30 message = new EbXMLRegistryResponse30(exchange.getIn().getBody(RegistryResponseType.class));
298 new RegistryResponseValidator().validate(message, XCMU.Interactions.CH_XCMU);
299 };
300
301
302
303
304 public static Processor iti18RequestValidator() {
305 return ITI_18_REQUEST_VALIDATOR;
306 }
307
308
309
310
311 public static Processor iti18ResponseValidator() {
312 return ITI_18_RESPONSE_VALIDATOR;
313 }
314
315
316
317
318 public static Processor iti38RequestValidator() {
319 return ITI_38_REQUEST_VALIDATOR;
320 }
321
322
323
324
325 public static Processor iti38ResponseValidator() {
326 return ITI_38_RESPONSE_VALIDATOR;
327 }
328
329
330
331
332 public static Processor iti39RequestValidator() {
333 return ITI_39_REQUEST_VALIDATOR;
334 }
335
336
337
338
339 public static Processor iti39ResponseValidator() {
340 return ITI_39_RESPONSE_VALIDATOR;
341 }
342
343
344
345
346 public static Processor iti41RequestValidator() {
347 return ITI_41_REQUEST_VALIDATOR;
348 }
349
350
351
352
353 public static Processor iti41XdmRequestValidator() {
354 return ITI_41_XDM_REQUEST_VALIDATOR;
355 }
356
357
358
359
360 public static Processor iti41XdrRequestValidator() {
361 return ITI_41_XDR_REQUEST_VALIDATOR;
362 }
363
364
365
366
367 public static Processor iti41ResponseValidator() {
368 return ITI_41_RESPONSE_VALIDATOR;
369 }
370
371
372
373
374 public static Processor iti42RequestValidator() {
375 return ITI_42_REQUEST_VALIDATOR;
376 }
377
378
379
380
381 public static Processor iti42ResponseValidator() {
382 return ITI_42_RESPONSE_VALIDATOR;
383 }
384
385
386
387
388 public static Processor iti43RequestValidator() {
389 return ITI_43_REQUEST_VALIDATOR;
390 }
391
392
393
394
395 public static Processor iti43ResponseValidator() {
396 return ITI_43_RESPONSE_VALIDATOR;
397 }
398
399
400
401
402 public static Processor iti51RequestValidator() {
403 return ITI_51_REQUEST_VALIDATOR;
404 }
405
406
407
408
409 public static Processor iti51ResponseValidator() {
410 return ITI_51_RESPONSE_VALIDATOR;
411 }
412
413
414
415
416 public static Processor iti57RequestValidator() {
417 return ITI_57_REQUEST_VALIDATOR;
418 }
419
420
421
422
423 public static Processor iti57ResponseValidator() {
424 return ITI_57_RESPONSE_VALIDATOR;
425 }
426
427
428
429
430 public static Processor iti61RequestValidator() {
431 return ITI_61_REQUEST_VALIDATOR;
432 }
433
434
435
436
437 public static Processor iti61ResponseValidator() {
438 return ITI_61_RESPONSE_VALIDATOR;
439 }
440
441
442
443
444 public static Processor iti62RequestValidator() {
445 return ITI_62_REQUEST_VALIDATOR;
446 }
447
448
449
450
451 public static Processor iti62ResponseValidator() {
452 return ITI_62_RESPONSE_VALIDATOR;
453 }
454
455
456
457
458 public static Processor iti63RequestValidator() {
459 return ITI_63_REQUEST_VALIDATOR;
460 }
461
462
463
464
465 public static Processor iti63ResponseValidator() {
466 return ITI_63_RESPONSE_VALIDATOR;
467 }
468
469
470
471
472 public static Processor iti86RequestValidator() {
473 return ITI_86_REQUEST_VALIDATOR;
474 }
475
476
477
478
479 public static Processor iti86ResponseValidator() {
480 return ITI_86_RESPONSE_VALIDATOR;
481 }
482
483
484
485
486 public static Processor chXcmuRequestValidator() {
487 return CH_XCMU_REQUEST_VALIDATOR;
488 }
489
490
491
492
493 public static Processor chXcmuResponseValidator() {
494 return CH_XCMU_RESPONSE_VALIDATOR;
495 }
496
497 private static final Processor RAD_69_REQUEST_VALIDATOR = exchange -> {
498 if (! validationEnabled(exchange)) {
499 return;
500 }
501 EbXMLRetrieveImagingDocumentSetRequest30 message =
502 new EbXMLRetrieveImagingDocumentSetRequest30(exchange.getIn().getBody(RetrieveImagingDocumentSetRequestType.class));
503 new RetrieveImagingDocumentSetRequestValidator().validate(message, RAD_69);
504 };
505
506 private static final Processor RAD_69_RESPONSE_VALIDATOR = exchange -> {
507 if (! validationEnabled(exchange)) {
508 return;
509 }
510 EbXMLRetrieveDocumentSetResponse30 message =
511 new EbXMLRetrieveDocumentSetResponse30(exchange.getIn().getBody(RetrieveDocumentSetResponseType.class));
512 new RetrieveDocumentSetResponseValidator().validate(message, RAD_69);
513 };
514
515 private static final Processor RAD_75_REQUEST_VALIDATOR = exchange -> {
516 if (! validationEnabled(exchange)) {
517 return;
518 }
519 EbXMLRetrieveImagingDocumentSetRequest30 message =
520 new EbXMLRetrieveImagingDocumentSetRequest30(exchange.getIn().getBody(RetrieveImagingDocumentSetRequestType.class));
521 new RetrieveImagingDocumentSetRequestValidator().validate(message, RAD_75);
522 };
523
524 private static final Processor RAD_75_RESPONSE_VALIDATOR = exchange -> {
525 if (! validationEnabled(exchange)) {
526 return;
527 }
528 EbXMLRetrieveDocumentSetResponse30 message =
529 new EbXMLRetrieveDocumentSetResponse30(exchange.getIn().getBody(RetrieveDocumentSetResponseType.class));
530 new RetrieveDocumentSetResponseValidator().validate(message, RAD_75);
531 };
532
533
534
535
536
537
538 public static Processor rad69RequestValidator() {
539 return RAD_69_REQUEST_VALIDATOR;
540 }
541
542
543
544
545
546
547 public static Processor rad69ResponseValidator() {
548 return RAD_69_RESPONSE_VALIDATOR;
549 }
550
551
552
553
554
555
556 public static Processor rad75RequestValidator() {
557 return RAD_75_REQUEST_VALIDATOR;
558 }
559
560
561
562
563
564
565 public static Processor rad75ResponseValidator() {
566 return RAD_75_RESPONSE_VALIDATOR;
567 }
568 }