1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.platform.camel.ihe.xds.iti41;
17
18 import lombok.extern.slf4j.Slf4j;
19 import org.apache.camel.Exchange;
20 import org.apache.camel.ExchangePattern;
21 import org.openehealth.ipf.commons.ihe.xds.core.XdsJaxbDataBinding;
22 import org.openehealth.ipf.commons.ihe.xds.iti41.Iti41PortType;
23 import org.openehealth.ipf.commons.ihe.xds.core.ebxml.ebxml30.ProvideAndRegisterDocumentSetRequestType;
24 import org.openehealth.ipf.commons.ihe.xds.core.responses.ErrorCode;
25 import org.openehealth.ipf.commons.ihe.xds.core.responses.Response;
26 import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rs.RegistryResponseType;
27 import org.openehealth.ipf.platform.camel.core.util.Exchanges;
28 import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWebService;
29 import org.openehealth.ipf.platform.camel.ihe.xds.core.converters.EbXML30Converters;
30
31
32
33
34
35
36
37
38 @Slf4j
39 public class Iti41Service extends AbstractWebService implements Iti41PortType {
40 @Override
41 public RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB(ProvideAndRegisterDocumentSetRequestType body) {
42 Exchange result = process(body, XdsJaxbDataBinding.getCamelHeaders(body.getSubmitObjectsRequest()), ExchangePattern.InOut);
43 Exception exception = Exchanges.extractException(result);
44 if (exception != null) {
45 log.debug("ITI-41 service failed", exception);
46 Response errorResponse = new Response(
47 exception,
48 ErrorCode.REPOSITORY_METADATA_ERROR,
49 ErrorCode.REPOSITORY_ERROR, null);
50 return EbXML30Converters.convert(errorResponse);
51 }
52
53 return Exchanges.resultMessage(result).getBody(RegistryResponseType.class);
54 }
55 }