One more fix for #4467
This commit is contained in:
parent
10060bef7f
commit
078dcd9c0d
|
@ -264,17 +264,16 @@ public class HashMapResourceProvider<T extends IBaseResource> implements IResour
|
|||
if (!versions.containsKey(versionId)) {
|
||||
throw new ResourceNotFoundException(Msg.code(1982) + theId);
|
||||
} else {
|
||||
T resource = versions.get(versionId);
|
||||
if (resource == null || ResourceMetadataKeyEnum.DELETED_AT.get(resource) != null) {
|
||||
throw new ResourceGoneException(Msg.code(1983) + theId);
|
||||
}
|
||||
retVal = resource;
|
||||
retVal = versions.get(versionId);
|
||||
}
|
||||
|
||||
} else {
|
||||
retVal = versions.lastEntry().getValue();
|
||||
}
|
||||
|
||||
if (retVal == null || ResourceMetadataKeyEnum.DELETED_AT.get(retVal) != null) {
|
||||
throw new ResourceGoneException(Msg.code(1983) + theId);
|
||||
}
|
||||
|
||||
myReadCount.incrementAndGet();
|
||||
|
||||
retVal = fireInterceptorsAndFilterAsNeeded(retVal, theRequestDetails);
|
||||
|
|
|
@ -115,8 +115,10 @@ public class HashMapResourceProviderTest {
|
|||
|
||||
assertEquals(1, myPatientResourceProvider.getCountDelete());
|
||||
|
||||
// Read
|
||||
// VRead original version
|
||||
ourRestServer.getFhirClient().read().resource("Patient").withId(id.withVersion("1")).execute();
|
||||
|
||||
// Vread gone version
|
||||
try {
|
||||
ourRestServer.getFhirClient().read().resource("Patient").withId(id.withVersion("2")).execute();
|
||||
fail();
|
||||
|
@ -124,6 +126,14 @@ public class HashMapResourceProviderTest {
|
|||
// good
|
||||
}
|
||||
|
||||
// Read (non vread) gone version
|
||||
try {
|
||||
ourRestServer.getFhirClient().read().resource("Patient").withId(id.toUnqualifiedVersionless()).execute();
|
||||
fail();
|
||||
} catch (ResourceGoneException e) {
|
||||
// good
|
||||
}
|
||||
|
||||
// History should include deleted entry
|
||||
Bundle history = ourRestServer.getFhirClient().history().onType(Patient.class).returnBundle(Bundle.class).execute();
|
||||
ourLog.info("History:\n{}", ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(history));
|
||||
|
|
Loading…
Reference in New Issue