From 1eb82d633d71467b2b2eeb0b5b4df80e3204848c Mon Sep 17 00:00:00 2001 From: Tadgh Date: Wed, 30 Jun 2021 18:41:18 -0400 Subject: [PATCH] Rip out pagingprovider requirement --- .../uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java | 4 +--- .../ca/uhn/fhir/mdm/provider/BaseMdmProvider.java | 5 ----- .../uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java | 11 ++++++----- .../ca/uhn/fhir/mdm/provider/MdmProviderLoader.java | 4 +--- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java index 756168188cb..5cbec2e45af 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java @@ -31,8 +31,6 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { private IMdmSubmitSvc myMdmSubmitSvc; @Autowired private MdmSettings myMdmSettings; - @Autowired - private IPagingProvider myPagingProvider; private String defaultScript; @@ -46,7 +44,7 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { @BeforeEach public void before() { - myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc, myPagingProvider); + myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc); defaultScript = myMdmSettings.getScriptText(); } @AfterEach diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/BaseMdmProvider.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/BaseMdmProvider.java index 239780fd69c..b20e790d2be 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/BaseMdmProvider.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/BaseMdmProvider.java @@ -28,7 +28,6 @@ import ca.uhn.fhir.mdm.api.paging.MdmPageLinkTuple; import ca.uhn.fhir.mdm.api.paging.MdmPageRequest; import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.server.RestfulServerUtils; import ca.uhn.fhir.rest.server.TransactionLogMessages; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.provider.ProviderConstants; @@ -39,10 +38,6 @@ import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.springframework.data.domain.Page; -import java.util.Arrays; - -import static ca.uhn.fhir.rest.api.Constants.PARAM_COUNT; -import static ca.uhn.fhir.rest.api.Constants.PARAM_OFFSET; public abstract class BaseMdmProvider { diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java index b1b4081fb3a..7ea63838fb5 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderDstu3Plus.java @@ -76,7 +76,9 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider { private final IMdmMatchFinderSvc myMdmMatchFinderSvc; private final IMdmExpungeSvc myMdmExpungeSvc; private final IMdmSubmitSvc myMdmSubmitSvc; - private final IPagingProvider myPagingProvider; + + public static final int DEFAULT_PAGE_SIZE = 20; + public static final int MAX_PAGE_SIZE = 100; /** * Constructor @@ -84,13 +86,12 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider { * Note that this is not a spring bean. Any necessary injections should * happen in the constructor */ - public MdmProviderDstu3Plus(FhirContext theFhirContext, IMdmControllerSvc theMdmControllerSvc, IMdmMatchFinderSvc theMdmMatchFinderSvc, IMdmExpungeSvc theMdmExpungeSvc, IMdmSubmitSvc theMdmSubmitSvc, IPagingProvider thePagingProvider) { + public MdmProviderDstu3Plus(FhirContext theFhirContext, IMdmControllerSvc theMdmControllerSvc, IMdmMatchFinderSvc theMdmMatchFinderSvc, IMdmExpungeSvc theMdmExpungeSvc, IMdmSubmitSvc theMdmSubmitSvc) { super(theFhirContext); myMdmControllerSvc = theMdmControllerSvc; myMdmMatchFinderSvc = theMdmMatchFinderSvc; myMdmExpungeSvc = theMdmExpungeSvc; myMdmSubmitSvc = theMdmSubmitSvc; - myPagingProvider = thePagingProvider; } @Operation(name = ProviderConstants.EMPI_MATCH, typeName = "Patient") @@ -213,7 +214,7 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider { UnsignedIntType theCount, ServletRequestDetails theRequestDetails) { - MdmPageRequest mdmPageRequest = new MdmPageRequest(theOffset, theCount, myPagingProvider.getDefaultPageSize(), myPagingProvider.getMaximumPageSize()); + MdmPageRequest mdmPageRequest = new MdmPageRequest(theOffset, theCount, DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE); Page mdmLinkJson = myMdmControllerSvc.queryLinks(extractStringOrNull(theGoldenResourceId), extractStringOrNull(theResourceId), extractStringOrNull(theMatchResult), extractStringOrNull(theLinkSource), createMdmContext(theRequestDetails, MdmTransactionContext.OperationType.QUERY_LINKS, @@ -233,7 +234,7 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider { UnsignedIntType theCount, ServletRequestDetails theRequestDetails) { - MdmPageRequest mdmPageRequest = new MdmPageRequest(theOffset, theCount, myPagingProvider.getDefaultPageSize(), myPagingProvider.getMaximumPageSize()); + MdmPageRequest mdmPageRequest = new MdmPageRequest(theOffset, theCount, DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE); Page possibleDuplicates = myMdmControllerSvc.getDuplicateGoldenResources(createMdmContext(theRequestDetails, MdmTransactionContext.OperationType.DUPLICATE_GOLDEN_RESOURCES, (String) null), mdmPageRequest); diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java index 27637899b8e..e63e6b17d50 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/provider/MdmProviderLoader.java @@ -49,8 +49,6 @@ public class MdmProviderLoader { private IMdmExpungeSvc myMdmExpungeSvc; @Autowired private IMdmSubmitSvc myMdmSubmitSvc; - @Autowired - private IPagingProvider myPagingProvider; private BaseMdmProvider myMdmProvider; @@ -59,7 +57,7 @@ public class MdmProviderLoader { case DSTU3: case R4: myResourceProviderFactory.addSupplier(() -> { - myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc, myPagingProvider); + myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmMatchFinderSvc, myMdmExpungeSvc, myMdmSubmitSvc); return myMdmProvider; }); break;