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 c1b1457 commit 5096e0f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.openehealth.ipf.commons.ihe.xds.core.responses.ErrorCode;
import org.openehealth.ipf.commons.ihe.xds.core.responses.RetrievedDocumentSet;
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 @@ -42,10 +43,11 @@ public XdsRetrieveDocumentSetService(String homeCommunityId) {

@SneakyThrows(InvalidPayloadException.class)
protected RetrieveDocumentSetResponseType processRequest(T 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 RetrievedDocumentSet(
exception,
ErrorCode.REPOSITORY_ERROR,
Expand All @@ -57,6 +59,6 @@ protected RetrieveDocumentSetResponseType processRequest(T body) {
return EbXML30Converters.convert(errorResponse);
}

return result.getMessage().getMandatoryBody(RetrieveDocumentSetResponseType.class);
return exchange.getMessage().getMandatoryBody(RetrieveDocumentSetResponseType.class);
}
}

0 comments on commit 5096e0f

Please sign in to comment.