diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java index 77a43ddc2e5..e8d1755c780 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java @@ -44,13 +44,13 @@ public interface ISearchParamExtractor { /** * Constant for the {@literal theSearchParamFilter} parameters on this interface - * indicating that all search parameters should be indexed. + * indicating that all search parameters should be extracted. */ ISearchParamFilter ALL_PARAMS = t -> t; /** * Constant for the {@literal theSearchParamFilter} parameters on this interface - * indicating that no search parameters should be indexed. + * indicating that no search parameters should be extracted. */ ISearchParamFilter NO_PARAMS = t -> Collections.emptyList(); @@ -155,7 +155,7 @@ public interface ISearchParamExtractor { interface ISearchParamFilter { /** - * Given the list of search parameters for indexing, an implementation of this + * Given the list of search parameters for extracting, an implementation of this * interface may selectively remove any that it wants to remove (or can add if desired). *

* Implementations must not modify the list that is passed in. If changes are diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/RestServerR4Helper.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/RestServerR4Helper.java index 5ac8aa67343..435d000939c 100644 --- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/RestServerR4Helper.java +++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/RestServerR4Helper.java @@ -221,6 +221,28 @@ public class RestServerR4Helper extends BaseRestServerHelper implements BeforeEa myRestServer.setConceptMapResourceProvider(theResourceProvider); } + public HashMapResourceProvider getResourceProvider(Class theResourceType) { + @SuppressWarnings("unchecked") + HashMapResourceProvider resourceProvider = (HashMapResourceProvider) myRestServer.myResourceProvidersMap.get(theResourceType); + assert resourceProvider != null : "No resource provider defined for resource type: '" + theResourceType + "'" ; + return resourceProvider; + } + + public void setResourceProvider(HashMapResourceProvider theResourceProvider) { + assert theResourceProvider.getResourceType() != null : "resourceProvider doesn't have a resourceType"; + @SuppressWarnings("unchecked") + HashMapResourceProvider resourceProvider = (HashMapResourceProvider) myRestServer.myResourceProvidersMap.get(theResourceProvider.getResourceType()); + + if (resourceProvider != null) { + resourceProvider.getStoredResources().forEach(theResourceProvider::store); + myRestServer.unregisterProvider(resourceProvider); + } + + registerProvider(theResourceProvider); + myRestServer.myResourceProvidersMap.put(theResourceProvider.getResourceType(), theResourceProvider); + } + + public void setPagingProvider(IPagingProvider thePagingProvider) { myPagingProvider = thePagingProvider; } @@ -295,6 +317,8 @@ public class RestServerR4Helper extends BaseRestServerHelper implements BeforeEa private HashMapResourceProvider myConceptMapResourceProvider; private RestServerDstu3Helper.MyPlainProvider myPlainProvider; + private final Map, HashMapResourceProvider> myResourceProvidersMap = new HashMap<>(); + private final boolean myInitialTransactionLatchEnabled; private PagingHttpMethodEnum myPagingHttpMethod = PagingHttpMethodEnum.GET;