Skip to content

Commit

Permalink
more flexible setting of homeCommunityId in XD* consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
unixoid committed Feb 13, 2025
1 parent 91d789b commit c1b1457
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryRequest;
import org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.query.AdhocQueryResponse;
import org.openehealth.ipf.platform.camel.core.util.Exchanges;
import org.openehealth.ipf.platform.camel.ihe.core.HomeCommunityUtils;
import org.openehealth.ipf.platform.camel.ihe.ws.AbstractWebService;
import org.openehealth.ipf.platform.camel.ihe.xds.core.converters.EbXML30Converters;

Expand All @@ -47,10 +48,11 @@ public XdsAdhocQueryService(String homeCommunityId) {

@SneakyThrows(InvalidPayloadException.class)
protected AdhocQueryResponse processRequest(AdhocQueryRequest body) {
var result = process(body);
var exception = Exchanges.extractException(result);
var exchange = process(body);
var exception = Exchanges.extractException(exchange);
if (exception != null) {
log.debug("{} service failed", getClass().getSimpleName(), exception);
String homeCommunityId = HomeCommunityUtils.getHomeCommunityId(exchange, this.homeCommunityId);
var errorResponse = new QueryResponse(
exception,
ErrorCode.REGISTRY_ERROR,
Expand All @@ -59,6 +61,6 @@ protected AdhocQueryResponse processRequest(AdhocQueryRequest body) {
errorResponse.getErrors().get(0).setLocation(homeCommunityId);
return EbXML30Converters.convert(errorResponse);
}
return result.getMessage().getMandatoryBody(AdhocQueryResponse.class);
return exchange.getMessage().getMandatoryBody(AdhocQueryResponse.class);
}
}

0 comments on commit c1b1457

Please sign in to comment.