wip with comments see 'fixme ep'
This commit is contained in:
parent
bc0ee995a2
commit
9b1b252ccb
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Paging
|
||||||
|
|
||||||
|
Paging is complicated.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
actor Client
|
||||||
|
participant RestfulServer
|
||||||
|
participant BaseResourceReturningMethodBinding
|
||||||
|
participant ConsentService
|
||||||
|
|
||||||
|
Client ->> RestfulServer: some search like Patient?code=active
|
||||||
|
RestfulServer ->> RestfulServer : lookup binding
|
||||||
|
|
||||||
|
RestfulServer ->>+ BaseResourceReturningMethodBinding: invoke doInvokeServer
|
||||||
|
|
||||||
|
BaseResourceReturningMethodBinding ->>+ BaseResourceReturningMethodBinding : invokeServer()
|
||||||
|
BaseResourceReturningMethodBinding --> PatientResourceProvider: Call search()
|
||||||
|
PatientResourceProvider ->> patientDao: delegate to search()
|
||||||
|
patientDao ->> searchCoordinatorService: delegate to registerSearch()
|
||||||
|
searchCoordinatorService ->> searchCoordinatorService : figure out kind of search ("sync" vs "async"), and IBundleProvider to return. Could be offset, or cached.
|
||||||
|
searchCoordinatorService --> patientDao: reply with IBundleProvider
|
||||||
|
PatientResourceProvider --> BaseResourceReturningMethodBinding: reply with IBundleProvider
|
||||||
|
BaseResourceReturningMethodBinding ->>- BaseResourceReturningMethodBinding: IBundleProvider
|
||||||
|
|
||||||
|
|
||||||
|
BaseResourceReturningMethodBinding ->> BaseResourceReturningMethodBinding: build Bundle from IBundleProvider with ResponseBundleBuilder
|
||||||
|
%% we have fetched exactly page size resources for the bundle here, but we are about to invoke Consent
|
||||||
|
%% need to move consent into here somehow which will throw some away
|
||||||
|
BaseResourceReturningMethodBinding ->> ConsentService: via callOutgoingResponseHook - nukes some entries from Bundle
|
||||||
|
|
||||||
|
BaseResourceReturningMethodBinding ->- RestfulServer: return actual Bundle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
What we need to do to avoid "blank spots" from the ConsentService is to move the call into consent
|
||||||
|
before we finalize the Bundle.
|
||||||
|
ca.uhn.fhir.rest.server.method.ResponseBundleBuilder#pagingBuildResourceList looks likely.
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -144,6 +145,7 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
|
||||||
Object[] params = createMethodParams(theRequest);
|
Object[] params = createMethodParams(theRequest);
|
||||||
|
|
||||||
Object resultObj = invokeServer(theServer, theRequest, params);
|
Object resultObj = invokeServer(theServer, theRequest, params);
|
||||||
|
// fixme ep resultObj already had the resources to be returned
|
||||||
if (resultObj == null) {
|
if (resultObj == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -194,11 +196,13 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
|
||||||
theServer,
|
theServer,
|
||||||
theRequest,
|
theRequest,
|
||||||
params,
|
params,
|
||||||
(IBundleProvider) resultObj,
|
bundleProvider,
|
||||||
count,
|
count,
|
||||||
responseBundleType,
|
responseBundleType,
|
||||||
linkSelf);
|
linkSelf);
|
||||||
|
// myResponseBundleBuilder instanceOf ResponseBundleBuilder
|
||||||
responseObject = myResponseBundleBuilder.buildResponseBundle(responseBundleRequest);
|
responseObject = myResponseBundleBuilder.buildResponseBundle(responseBundleRequest);
|
||||||
|
// fixme ep We need to call consent somewhere above here
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class ResponseBundleBuilder {
|
||||||
|
|
||||||
private static IBaseBundle buildBundle(
|
private static IBaseBundle buildBundle(
|
||||||
ResponseBundleRequest theResponseBundleRequest, ResponsePage pageResponse, BundleLinks links) {
|
ResponseBundleRequest theResponseBundleRequest, ResponsePage pageResponse, BundleLinks links) {
|
||||||
|
|
||||||
final IRestfulServer<?> server = theResponseBundleRequest.server;
|
final IRestfulServer<?> server = theResponseBundleRequest.server;
|
||||||
final IVersionSpecificBundleFactory bundleFactory =
|
final IVersionSpecificBundleFactory bundleFactory =
|
||||||
server.getFhirContext().newBundleFactory();
|
server.getFhirContext().newBundleFactory();
|
||||||
|
@ -157,6 +158,10 @@ public class ResponseBundleBuilder {
|
||||||
ResponsePage.ResponsePageBuilder theResponsePageBuilder) {
|
ResponsePage.ResponsePageBuilder theResponsePageBuilder) {
|
||||||
final List<IBaseResource> retval;
|
final List<IBaseResource> retval;
|
||||||
if (theNumToReturn > 0 || theBundleProvider.getCurrentPageId() != null) {
|
if (theNumToReturn > 0 || theBundleProvider.getCurrentPageId() != null) {
|
||||||
|
// fixme ep
|
||||||
|
// fetch a page worth and invoke on consent, if not enough, go fecth more, and run consent.
|
||||||
|
// this can be tricky at this point. we would need to get to here with a clean and full resourceList
|
||||||
|
// (theBundleProvider.getResources())
|
||||||
retval = theBundleProvider.getResources(
|
retval = theBundleProvider.getResources(
|
||||||
theResponseBundleRequest.offset,
|
theResponseBundleRequest.offset,
|
||||||
theNumToReturn + theResponseBundleRequest.offset,
|
theNumToReturn + theResponseBundleRequest.offset,
|
||||||
|
|
Loading…
Reference in New Issue