Fix missing ID with JAX-RS and DSTU2 RI

While using DSTU2 reference implementation, the ID was not correctly initialized in the request object
This commit is contained in:
Carlo Mion 2016-07-13 20:08:23 +02:00 committed by GitHub
parent f6601cc347
commit cf6474dd7b
1 changed files with 3 additions and 3 deletions

View File

@ -137,7 +137,7 @@ public class JaxRsRequest extends RequestDetails {
FhirVersionEnum fhirContextVersion = myServer.getFhirContext().getVersion().getVersion(); FhirVersionEnum fhirContextVersion = myServer.getFhirContext().getVersion().getVersion();
if (StringUtils.isNotBlank(myVersion)) { if (StringUtils.isNotBlank(myVersion)) {
if (FhirVersionEnum.DSTU3.equals(fhirContextVersion)) { if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
result.setId( result.setId(
new IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); new IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
} else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) { } else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
@ -145,7 +145,7 @@ public class JaxRsRequest extends RequestDetails {
new IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); new IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
} }
} else if (StringUtils.isNotBlank(myId)) { } else if (StringUtils.isNotBlank(myId)) {
if (FhirVersionEnum.DSTU3.equals(fhirContextVersion)) { if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
result.setId(new IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); result.setId(new IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
} else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) { } else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
result.setId(new IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); result.setId(new IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
@ -155,7 +155,7 @@ public class JaxRsRequest extends RequestDetails {
if (myRestOperation == RestOperationTypeEnum.UPDATE) { if (myRestOperation == RestOperationTypeEnum.UPDATE) {
String contentLocation = result.getHeader(Constants.HEADER_CONTENT_LOCATION); String contentLocation = result.getHeader(Constants.HEADER_CONTENT_LOCATION);
if (contentLocation != null) { if (contentLocation != null) {
if (FhirVersionEnum.DSTU3.equals(fhirContextVersion)) { if (FhirVersionEnum.DSTU3.equals(fhirContextVersion) || FhirVersionEnum.DSTU2_HL7ORG.equals(fhirContextVersion)) {
result.setId(new IdType(contentLocation)); result.setId(new IdType(contentLocation));
} else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) { } else if (FhirVersionEnum.DSTU2.equals(fhirContextVersion)) {
result.setId(new IdDt(contentLocation)); result.setId(new IdDt(contentLocation));