From f455642ff2f4eff030132eac6b4bf70034bcbc3f Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Sun, 4 Dec 2022 19:14:35 -0500 Subject: [PATCH] Final TODOs --- .../ca/uhn/fhir/jpa/config/JpaConfig.java | 4 +-- .../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 12 +++---- .../fhir/jpa/dao/BaseHapiFhirSystemDao.java | 4 +-- .../fhir/jpa/dao/FulltextSearchSvcImpl.java | 20 +++++------ .../uhn/fhir/jpa/dao/IFulltextSearchSvc.java | 8 ++--- .../jpa/dao/JpaResourceDaoCodeSystem.java | 6 ++-- .../jpa/dao/index/IJpaIdHelperService.java | 3 +- .../fhir/jpa/dao/index/IdHelperService.java | 6 ++-- .../fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java | 26 +++++++------- .../fhir/jpa/reindex/Batch2DaoSvcImpl.java | 8 ++--- .../search/lastn/ElasticsearchSvcImpl.java | 6 ++-- .../jpa/search/lastn/IElasticsearchSvc.java | 4 +-- .../term/TermCodeSystemStorageSvcImpl.java | 12 +++---- .../ca/uhn/fhir/jpa/term/TermReadSvcImpl.java | 4 +-- .../term/api/ITermCodeSystemStorageSvc.java | 14 ++++---- .../svc/JpaBulkExportProcessorTest.java | 34 +++++++++---------- ...esourceDaoR4SearchWithElasticSearchIT.java | 6 ++-- .../uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java | 28 +++++++-------- .../mdm/svc/GoldenResourceMergerSvcImpl.java | 5 ++- .../mdm/svc/GoldenResourceSearchSvcImpl.java | 4 +-- .../fhir/jpa/mdm/svc/MdmEidUpdateService.java | 5 ++- .../jpa/mdm/svc/MdmLinkCreateSvcImpl.java | 6 ++-- .../uhn/fhir/jpa/mdm/svc/MdmLinkSvcImpl.java | 11 +++--- .../jpa/mdm/svc/MdmLinkUpdaterSvcImpl.java | 12 +++---- .../uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvc.java | 6 ++-- .../fhir/jpa/mdm/svc/MdmResourceDaoSvc.java | 6 ++-- .../svc/candidate/FindCandidateByEidSvc.java | 4 +-- .../candidate/FindCandidateByExampleSvc.java | 8 ++--- .../svc/candidate/FindCandidateByLinkSvc.java | 6 ++-- .../MatchedGoldenResourceCandidate.java | 11 +++--- .../svc/candidate/MdmCandidateSearchSvc.java | 8 ++--- .../MdmGoldenResourceFindingSvc.java | 4 +-- .../matcher/BaseGoldenResourceMatcher.java | 10 +++--- .../uhn/fhir/jpa/mdm/matcher/IsLinkedTo.java | 6 ++-- .../mdm/matcher/IsPossibleDuplicateOf.java | 6 ++-- .../jpa/mdm/matcher/IsPossibleLinkedTo.java | 6 ++-- .../jpa/mdm/matcher/IsPossibleMatchWith.java | 6 ++-- .../mdm/matcher/IsSameGoldenResourceAs.java | 6 ++-- .../jpa/mdm/svc/MdmLinkCreateSvcImplTest.java | 8 ++--- .../MdmMatchLinkSvcMultipleEidModeTest.java | 4 +-- .../fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java | 6 ++-- .../fhir/jpa/model/cross/IResourceLookup.java | 4 +-- .../ca/uhn/fhir/jpa/model/dao/JpaPid.java | 4 +-- .../fhir/jpa/model/entity/ResourceTable.java | 4 +-- .../jpa/cache/ResourcePersistentIdMap.java | 12 +++---- .../SearchParamExtractorService.java | 4 +-- .../SubscriptionTriggeringSvcImpl.java | 6 ++-- .../FhirResourceDaoDstu2SearchNoFtTest.java | 5 ++- .../dao/dstu2/FhirResourceDaoDstu2Test.java | 8 ++--- .../ca/uhn/fhir/jpa/search/BaseSearchSvc.java | 4 +-- .../search/SearchCoordinatorSvcImplTest.java | 8 ++--- .../dao/dstu3/FhirResourceDaoDstu3Test.java | 8 ++--- .../jpa/dao/r4/FhirResourceDaoR4Test.java | 8 ++--- .../provider/r4/HookInterceptorR4Test.java | 4 +-- .../BaseValueSetHSearchExpansionR4Test.java | 1 - .../jpa/dao/expunge/PartitionRunnerTest.java | 32 ++++++++--------- .../jpa/dao/index/ResourceVersionSvcTest.java | 14 ++++---- .../java/ca/uhn/fhir/mdm/api/IMdmLink.java | 4 +-- .../uhn/fhir/mdm/api/IMdmLinkExpandSvc.java | 8 ++--- .../java/ca/uhn/fhir/mdm/api/IMdmLinkSvc.java | 4 +-- .../java/ca/uhn/fhir/mdm/dao/IMdmLinkDao.java | 25 +++++++------- .../ca/uhn/fhir/mdm/model/MdmPidTuple.java | 4 +-- .../ca/uhn/fhir/mdm/svc/MdmLinkDeleteSvc.java | 6 ++-- .../ca/uhn/fhir/mdm/svc/MdmLinkExpandSvc.java | 17 +++++----- .../ca/uhn/fhir/mdm/svc/MdmSubmitSvcImpl.java | 6 ++-- ...tId.java => BaseResourcePersistentId.java} | 12 +++---- .../rest/api/server/storage/NotFoundPid.java | 2 +- .../server/storage/TransactionDetails.java | 16 ++++----- .../jobs/export/ExpandResourcesStep.java | 4 +-- .../jobs/export/FetchResourceIdsStep.java | 7 ++-- .../batch2/jobs/imprt/ConsumeFilesStep.java | 6 ++-- .../ca/uhn/fhir/batch2/jobs/models/Id.java | 5 ++- .../fhir/batch2/jobs/reindex/ReindexStep.java | 8 ++--- .../jobs/export/ExpandResourcesStepTest.java | 7 ++-- .../jobs/export/FetchResourceIdsStepTest.java | 12 +++---- .../chunk/ResourceIdListWorkChunkJson.java | 4 +-- .../batch2/jobs/step/LoadIdsStepTest.java | 4 +-- .../MdmInflateAndSubmitResourcesStep.java | 8 ++--- .../fhir/jpa/api/dao/IFhirResourceDao.java | 14 ++++---- .../uhn/fhir/jpa/api/dao/IFhirSystemDao.java | 4 +-- .../fhir/jpa/api/model/DaoMethodOutcome.java | 8 ++--- .../jpa/api/model/LazyDaoMethodOutcome.java | 4 +-- .../api/model/PersistentIdToForcedIdMap.java | 4 +-- .../fhir/jpa/api/pid/BaseResourcePidList.java | 10 +++--- .../jpa/api/pid/EmptyResourcePidList.java | 4 +-- .../api/pid/HomogeneousResourcePidList.java | 4 +-- .../fhir/jpa/api/pid/IResourcePidList.java | 4 +-- .../jpa/api/pid/MixedResourcePidList.java | 4 +-- .../jpa/api/pid/ResourcePidListBuilder.java | 4 +-- .../fhir/jpa/api/pid/TypedResourcePid.java | 6 ++-- .../fhir/jpa/api/svc/IIdHelperService.java | 6 ++-- .../jpa/api/svc/ISearchCoordinatorSvc.java | 4 +-- .../bulk/export/api/IBulkExportProcessor.java | 4 +-- .../ca/uhn/fhir/jpa/dao/BaseStorageDao.java | 6 ++-- .../fhir/jpa/dao/BaseStorageResourceDao.java | 8 ++--- .../ca/uhn/fhir/jpa/dao/IResultIterator.java | 4 +-- .../ca/uhn/fhir/jpa/dao/ISearchBuilder.java | 4 +-- .../fhir/jpa/dao/MatchResourceUrlService.java | 4 +-- .../fhir/jpa/dao/SearchBuilderFactory.java | 4 +-- .../jpa/dao/expunge/ExpungeOperation.java | 20 +++++------ .../fhir/jpa/dao/expunge/ExpungeService.java | 8 ++--- .../dao/expunge/IResourceExpungeService.java | 4 +-- .../fhir/jpa/dao/expunge/PartitionRunner.java | 10 +++--- .../dao/index/DaoResourceLinkResolver.java | 6 ++-- .../SearchParamValidatingInterceptor.java | 13 ++----- ...rchParameterValidatingInterceptorTest.java | 4 +-- 106 files changed, 407 insertions(+), 426 deletions(-) rename hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/{ResourcePersistentId.java => BaseResourcePersistentId.java} (84%) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java index 7459219e1b9..feec065b591 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java @@ -134,8 +134,8 @@ import ca.uhn.fhir.jpa.validation.ResourceLoaderImpl; import ca.uhn.fhir.jpa.validation.ValidationSettings; import ca.uhn.fhir.mdm.svc.MdmLinkExpandSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.IDeleteExpungeJobSubmitter; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices; @@ -680,7 +680,7 @@ public class JpaConfig { @Bean @Scope("prototype") - public ExpungeOperation expungeOperation(String theResourceName, ResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { + public ExpungeOperation expungeOperation(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { return new ExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequestDetails); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 8d12347a21d..d397156d60f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -84,8 +84,8 @@ import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.SimplePreResourceAccessDetails; import ca.uhn.fhir.rest.api.server.SimplePreResourceShowDetails; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.IDeleteExpungeJobSubmitter; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.HasParam; import ca.uhn.fhir.rest.param.HistorySearchDateRangeParam; @@ -671,7 +671,7 @@ public abstract class BaseHapiFhirResourceDao extends B @Nonnull @Override - public

DeleteMethodOutcome deletePidList(String theUrl, Collection

theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest) { + public

DeleteMethodOutcome deletePidList(String theUrl, Collection

theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest) { StopWatch w = new StopWatch(); TransactionDetails transactionDetails = new TransactionDetails(); List deletedResources = new ArrayList<>(); @@ -1133,13 +1133,13 @@ public abstract class BaseHapiFhirResourceDao extends B @Override @Transactional - public T readByPid(ResourcePersistentId thePid) { + public T readByPid(BaseResourcePersistentId thePid) { return readByPid(thePid, false); } @Override @Transactional - public T readByPid(ResourcePersistentId thePid, boolean theDeletedOk) { + public T readByPid(BaseResourcePersistentId thePid, boolean theDeletedOk) { StopWatch w = new StopWatch(); JpaPid jpaPid = (JpaPid) thePid; @@ -1230,7 +1230,7 @@ public abstract class BaseHapiFhirResourceDao extends B @SuppressWarnings("unchecked") @Override - public void reindex(ResourcePersistentId theJpaPid, RequestDetails theRequest, TransactionDetails theTransactionDetails) { + public void reindex(BaseResourcePersistentId theJpaPid, RequestDetails theRequest, TransactionDetails theTransactionDetails) { Optional entityOpt = myResourceTableDao.findById(((JpaPid) theJpaPid).getId()); if (!entityOpt.isPresent()) { ourLog.warn("Unable to find entity with PID: {}", ((JpaPid) theJpaPid).getId()); @@ -1322,7 +1322,7 @@ public abstract class BaseHapiFhirResourceDao extends B } @Override - protected IBasePersistedResource readEntityLatestVersion(ResourcePersistentId thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails) { + protected IBasePersistedResource readEntityLatestVersion(BaseResourcePersistentId thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails) { JpaPid jpaPid = (JpaPid) thePersistentId; return myEntityManager.find(ResourceTable.class, jpaPid.getId()); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java index 6502acd2f01..3fbfb13415e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java @@ -19,7 +19,7 @@ import ca.uhn.fhir.jpa.util.QueryChunker; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; import ca.uhn.fhir.util.StopWatch; import com.google.common.annotations.VisibleForTesting; @@ -163,7 +163,7 @@ public abstract class BaseHapiFhirSystemDao extends B @Override @Transactional(propagation = Propagation.MANDATORY) - public

void preFetchResources(List

theResolvedIds) { + public

void preFetchResources(List

theResolvedIds) { List pids = theResolvedIds .stream() .map(t -> ((JpaPid) t).getId()) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java index b4d439f8ce9..8f0dac88e17 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java @@ -44,7 +44,7 @@ import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.rest.server.util.ResourceSearchParams; import com.google.common.collect.Ordering; @@ -157,7 +157,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { // keep this in sync with supportsSomeOf(); private ISearchQueryExecutor doSearch(String theResourceType, SearchParameterMap theParams, - ResourcePersistentId theReferencingPid, Integer theMaxResultsToFetch) { + BaseResourcePersistentId theReferencingPid, Integer theMaxResultsToFetch) { int offset = theParams.getOffset() == null ? 0 : theParams.getOffset(); int count = getMaxFetchSize(theParams, theMaxResultsToFetch); @@ -186,7 +186,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private SearchQueryOptionsStep getSearchQueryOptionsStep( - String theResourceType, SearchParameterMap theParams, ResourcePersistentId theReferencingPid) { + String theResourceType, SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) { dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); var query= getSearchSession().search(ResourceTable.class) @@ -214,7 +214,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private PredicateFinalStep buildWhereClause(SearchPredicateFactory f, String theResourceType, - SearchParameterMap theParams, ResourcePersistentId theReferencingPid) { + SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) { return f.bool(b -> { ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f); @@ -262,18 +262,18 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { return Search.session(myEntityManager); } - private List convertLongsToResourcePersistentIds(List theLongPids) { + private List convertLongsToResourcePersistentIds(List theLongPids) { return theLongPids.stream() .map(JpaPid::new) .collect(Collectors.toList()); } @Override - public List everything(String theResourceName, SearchParameterMap theParams, ResourcePersistentId theReferencingPid) { + public List everything(String theResourceName, SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) { validateHibernateSearchIsEnabled(); // todo mb what about max results here? - List retVal = toList(doSearch(null, theParams, theReferencingPid, 10_000), 10_000); + List retVal = toList(doSearch(null, theParams, theReferencingPid, 10_000), 10_000); if (theReferencingPid != null) { retVal.add(theReferencingPid); } @@ -311,7 +311,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { @Transactional() @Override - public List search(String theResourceName, SearchParameterMap theParams) { + public List search(String theResourceName, SearchParameterMap theParams) { validateHibernateSearchIsEnabled(); return toList(doSearch(theResourceName, theParams, null, DEFAULT_MAX_NON_PAGED_SIZE), DEFAULT_MAX_NON_PAGED_SIZE); } @@ -319,7 +319,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { /** * Adapt our async interface to the legacy concrete List */ - private List toList(ISearchQueryExecutor theSearchResultStream, long theMaxSize) { + private List toList(ISearchQueryExecutor theSearchResultStream, long theMaxSize) { return StreamSupport.stream(Spliterators.spliteratorUnknownSize(theSearchResultStream, 0), false) .map(JpaPid::new) .limit(theMaxSize) @@ -357,7 +357,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { } @Override - public List lastN(SearchParameterMap theParams, Integer theMaximumResults) { + public List lastN(SearchParameterMap theParams, Integer theMaximumResults) { ensureElastic(); dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); List pidList = new LastNOperation(getSearchSession(), myFhirContext, myModelConfig, mySearchParamRegistry) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFulltextSearchSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFulltextSearchSvc.java index 9b23eefc946..5087e045dc9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFulltextSearchSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFulltextSearchSvc.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.jpa.search.autocomplete.ValueSetAutocompleteOptions; import ca.uhn.fhir.jpa.search.builder.ISearchQueryExecutor; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import java.util.Collection; @@ -43,7 +43,7 @@ public interface IFulltextSearchSvc { * @param theParams the full query - modified to return only params unused by the index. * @return the pid list for the matchign resources. */ - List search(String theResourceName, SearchParameterMap theParams); + List search(String theResourceName, SearchParameterMap theParams); /** @@ -63,7 +63,7 @@ public interface IFulltextSearchSvc { */ IBaseResource tokenAutocompleteValueSetSearch(ValueSetAutocompleteOptions theOptions); - List everything(String theResourceName, SearchParameterMap theParams, T theReferencingPid); + List everything(String theResourceName, SearchParameterMap theParams, T theReferencingPid); boolean isDisabled(); @@ -81,7 +81,7 @@ public interface IFulltextSearchSvc { */ void reindex(ResourceTable theEntity); - List lastN(SearchParameterMap theParams, Integer theMaximumResults); + List lastN(SearchParameterMap theParams, Integer theMaximumResults); /** * Returns inlined resource stored along with index mappings for matched identifiers diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java index f8285ba471b..50a7a4e8a81 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java @@ -36,7 +36,7 @@ import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.util.LogicUtil; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -88,9 +88,9 @@ public class JpaResourceDaoCodeSystem extends BaseHapiF @Override public List findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem, RequestDetails theRequest) { List valueSetIds; - List ids = searchForIds(new SearchParameterMap(org.hl7.fhir.r4.model.CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest); + List ids = searchForIds(new SearchParameterMap(org.hl7.fhir.r4.model.CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest); valueSetIds = new ArrayList<>(); - for (ResourcePersistentId next : ids) { + for (BaseResourcePersistentId next : ids) { IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next); valueSetIds.add(id); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IJpaIdHelperService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IJpaIdHelperService.java index 9ea51a9e1fd..4aac4332c0d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IJpaIdHelperService.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IJpaIdHelperService.java @@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.dao.index; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.model.dao.JpaPid; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -44,7 +45,7 @@ import java.util.Set; * All of the methods here aren't partition aware, so it's not great to use them * anyhow. The equivalents in {@link IIdHelperService} are probably a bit more * clunky because you have to convert between {@link Long} and - * {@link ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId} to use them, + * {@link BaseResourcePersistentId} to use them, * but they also have caching and partition awareness so the tradeoff for that * extra effort is that they are better. */ diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java index 433460ee5a2..1997075f479 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java @@ -38,7 +38,7 @@ import ca.uhn.fhir.jpa.search.builder.SearchBuilder; import ca.uhn.fhir.jpa.util.MemoryCacheService; import ca.uhn.fhir.jpa.util.QueryChunker; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -93,7 +93,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; *

* This service is highly optimized in order to minimize the number of DB calls as much as possible, * since ID resolution is fundamental to many basic operations. This service returns either - * {@link IResourceLookup} or {@link ResourcePersistentId} depending on the method being called. + * {@link IResourceLookup} or {@link BaseResourcePersistentId} depending on the method being called. * The former involves an extra database join that the latter does not require, so selecting the * right method here is important. *

@@ -626,7 +626,7 @@ public class IdHelperService implements IIdHelperService { retVal.put(nextResourcePid, Optional.empty()); myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.PID_TO_FORCED_ID, nextResourcePid, Optional.empty()); } - Map> convertRetVal = new HashMap<>(); + Map> convertRetVal = new HashMap<>(); retVal.forEach( (k, v) -> { convertRetVal.put(new JpaPid(k), v); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java index 168ba26b155..4fa51b7ae11 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java @@ -23,16 +23,16 @@ package ca.uhn.fhir.jpa.dao.mdm; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.data.IMdmLinkJpaRepository; import ca.uhn.fhir.jpa.entity.MdmLink; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.api.paging.MdmPageRequest; import ca.uhn.fhir.mdm.dao.IMdmLinkDao; import ca.uhn.fhir.mdm.model.MdmPidTuple; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; @@ -66,17 +66,17 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { private IIdHelperService myIdHelperService; @Override - public int deleteWithAnyReferenceToPid(ResourcePersistentId thePid) { + public int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid) { return myMdmLinkDao.deleteWithAnyReferenceToPid(((JpaPid) thePid).getId()); } @Override - public int deleteWithAnyReferenceToPidAndMatchResultNot(ResourcePersistentId thePid, MdmMatchResultEnum theMatchResult) { + public int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult) { return myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(((JpaPid) thePid).getId(), theMatchResult); } @Override - public List expandPidsFromGroupPidGivenMatchResult(ResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum) { + public List expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum) { return myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(((JpaPid) theGroupPid).getId(), theMdmMatchResultEnum) .stream() .map( theMdmPidTuple -> new MdmPidTuple() @@ -86,7 +86,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public List expandPidsBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) { + public List expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) { return myMdmLinkDao.expandPidsBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum) .stream() .map( theMdmPidTuple -> new MdmPidTuple() @@ -96,7 +96,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public List expandPidsByGoldenResourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) { + public List expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) { return myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum) .stream() .map( theMdmPidTuple -> new MdmPidTuple() @@ -106,7 +106,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public List findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable) { + public List findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable) { return myMdmLinkDao.findPidByResourceNameAndThreshold(theResourceName,theHighThreshold, thePageable) .stream() .map( theResourcePids -> new JpaPid(theResourcePids)) @@ -114,7 +114,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public List findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List thePartitionIds, Pageable thePageable) { + public List findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List thePartitionIds, Pageable thePageable) { return myMdmLinkDao.findPidByResourceNameAndThresholdAndPartitionId(theResourceName,theHighThreshold, thePartitionIds, thePageable) .stream() .map( theResourcePids -> new JpaPid(theResourcePids)) @@ -122,13 +122,13 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public List findAllById(List thePids) { + public List findAllById(List thePids) { List theLongPids = thePids.stream().map(thePid -> ((JpaPid) thePid).getId()).collect(Collectors.toList()); return myMdmLinkDao.findAllById(theLongPids); } @Override - public Optional findById(ResourcePersistentId thePid) { + public Optional findById(BaseResourcePersistentId thePid) { return myMdmLinkDao.findById(((JpaPid) thePid).getId()); } @@ -227,12 +227,12 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao { } @Override - public Optional findBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch) { + public Optional findBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch) { return myMdmLinkDao.findBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMatch); } @Override - public void deleteLinksWithAnyReferenceToPids(List theResourcePersistentIds) { + public void deleteLinksWithAnyReferenceToPids(List theResourcePersistentIds) { List goldenResourcePids = theResourcePersistentIds.stream().map(pid -> ((JpaPid) pid).getId()).collect(Collectors.toList()); // Split into chunks of 500 so older versions of Oracle don't run into issues (500 = 1000 / 2 since the dao // method uses the list twice in the sql predicate) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/reindex/Batch2DaoSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/reindex/Batch2DaoSvcImpl.java index 8f457a30ddf..289c9bb1705 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/reindex/Batch2DaoSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/reindex/Batch2DaoSvcImpl.java @@ -30,15 +30,15 @@ import ca.uhn.fhir.jpa.api.pid.HomogeneousResourcePidList; import ca.uhn.fhir.jpa.api.pid.IResourcePidList; import ca.uhn.fhir.jpa.api.pid.MixedResourcePidList; import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.util.DateRangeUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -96,7 +96,7 @@ public class Batch2DaoSvcImpl implements IBatch2DaoSvc { IFhirResourceDao dao = myDaoRegistry.getResourceDao(resourceType); SystemRequestDetails request = new SystemRequestDetails(); request.setRequestPartitionId(theRequestPartitionId); - List ids = dao.searchForIds(searchParamMap, request); + List ids = dao.searchForIds(searchParamMap, request); Date lastDate = null; if (ids.size() > 0) { @@ -123,7 +123,7 @@ public class Batch2DaoSvcImpl implements IBatch2DaoSvc { return new EmptyResourcePidList(); } - List ids = content + List ids = content .stream() .map(t -> new JpaPid((Long) t[0])) .collect(Collectors.toList()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java index 7d2ffe49a15..e6c5ea2a963 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java @@ -32,7 +32,7 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.util.LastNParameterHelper; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.parser.IParser; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.ParamPrefixEnum; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -752,7 +752,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc { } @Override - public List getObservationResources(Collection thePids) { + public List getObservationResources(Collection thePids) { SearchRequest searchRequest = buildObservationResourceSearchRequest(thePids); try { SearchResponse observationDocumentResponse = executeSearchRequest(searchRequest); @@ -780,7 +780,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc { } } - private SearchRequest buildObservationResourceSearchRequest(Collection thePids) { + private SearchRequest buildObservationResourceSearchRequest(Collection thePids) { SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); // Query diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java index 0c4c3444e99..cf36108c380 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.search.lastn.json.CodeJson; import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import java.io.IOException; @@ -96,6 +96,6 @@ public interface IElasticsearchSvc { * @param thePids * @return Resources list or empty if nothing found */ - List getObservationResources(Collection thePids); + List getObservationResources(Collection thePids); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java index 472032367a2..e9ec49e468f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java @@ -27,7 +27,6 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemDao; import ca.uhn.fhir.jpa.dao.data.ITermCodeSystemVersionDao; @@ -41,6 +40,7 @@ import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptDesignation; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; import ca.uhn.fhir.jpa.entity.TermConceptProperty; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; @@ -49,7 +49,7 @@ import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.util.ObjectUtil; @@ -340,9 +340,9 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { @Override @Transactional - public void storeNewCodeSystemVersion(ResourcePersistentId theCodeSystemResourcePid, String theSystemUri, - String theSystemName, String theCodeSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, - ResourceTable theCodeSystemResourceTable, RequestDetails theRequestDetails) { + public void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, + String theSystemName, String theCodeSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, + ResourceTable theCodeSystemResourceTable, RequestDetails theRequestDetails) { assert TransactionSynchronizationManager.isActualTransactionActive(); ourLog.debug("Storing code system"); @@ -630,7 +630,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { } @Nonnull - private TermCodeSystem getOrCreateDistinctTermCodeSystem(ResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, String theSystemVersionId, ResourceTable theCodeSystemResourceTable) { + private TermCodeSystem getOrCreateDistinctTermCodeSystem(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, String theSystemVersionId, ResourceTable theCodeSystemResourceTable) { TermCodeSystem codeSystem = myCodeSystemDao.findByCodeSystemUri(theSystemUri); if (codeSystem == null) { codeSystem = myCodeSystemDao.findByResourcePid(((JpaPid) theCodeSystemResourcePid).getId()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java index 7b3a72611bd..363e57b2e5d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java @@ -75,7 +75,7 @@ import ca.uhn.fhir.jpa.term.api.ReindexTerminologyResult; import ca.uhn.fhir.jpa.term.ex.ExpansionTooCostlyException; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -1695,7 +1695,7 @@ public class TermReadSvcImpl implements ITermReadSvc { .setMessage("Unable to validate code " + theSystem + "#" + theCode + theAppend); } - private List findByValueSetResourcePidSystemAndCode(ResourcePersistentId theResourcePid, String theSystem, String theCode) { + private List findByValueSetResourcePidSystemAndCode(BaseResourcePersistentId theResourcePid, String theSystem, String theCode) { assert TransactionSynchronizationManager.isSynchronizationActive(); List retVal = new ArrayList<>(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java index 0e08ff6c1dd..d1123d5d67c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/api/ITermCodeSystemStorageSvc.java @@ -26,12 +26,12 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.UploadStatistics; import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.ValueSet; - import org.springframework.transaction.annotation.Transactional; + import java.util.List; /** @@ -50,16 +50,16 @@ public interface ITermCodeSystemStorageSvc { (boolean) theRequestDetails.getUserData().getOrDefault(MAKE_LOADING_VERSION_CURRENT, Boolean.TRUE); } - void storeNewCodeSystemVersion(ResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, - String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable, - RequestDetails theRequestDetails); + void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, + String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable, + RequestDetails theRequestDetails); /** * Default implementation supports previous signature of method which was added RequestDetails parameter */ @Transactional - default void storeNewCodeSystemVersion(ResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, - String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable) { + default void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName, + String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable) { storeNewCodeSystemVersion(theCodeSystemResourcePid, theSystemUri, theSystemName, theSystemVersionId, theCodeSystemVersion, theCodeSystemResourceTable, null); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java index 2057eff5ee4..ad7a5355fb5 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java @@ -22,7 +22,7 @@ import ca.uhn.fhir.mdm.dao.IMdmLinkDao; import ca.uhn.fhir.mdm.model.MdmPidTuple; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.r4.model.Group; @@ -66,11 +66,11 @@ public class JpaBulkExportProcessorTest { private class ListResultIterator implements IResultIterator { - private List myList; + private List myList; private int index; - public ListResultIterator(List theList) { + public ListResultIterator(List theList) { myList = theList; } @@ -85,7 +85,7 @@ public class JpaBulkExportProcessorTest { } @Override - public Collection getNextResultBatch(long theBatchSize) { + public Collection getNextResultBatch(long theBatchSize) { return null; } @@ -100,7 +100,7 @@ public class JpaBulkExportProcessorTest { } @Override - public ResourcePersistentId next() { + public BaseResourcePersistentId next() { return myList.get(index++); } } @@ -159,12 +159,12 @@ public class JpaBulkExportProcessorTest { private MdmPidTuple createTuple(long theGroupId, long theGoldenId) { return new MdmPidTuple() { @Override - public ResourcePersistentId getGoldenPid() { + public BaseResourcePersistentId getGoldenPid() { return new JpaPid(theGoldenId); } @Override - public ResourcePersistentId getSourcePid() { + public BaseResourcePersistentId getSourcePid() { return new JpaPid(theGroupId); } }; @@ -253,7 +253,7 @@ public class JpaBulkExportProcessorTest { groupResource.setId(parameters.getGroupId()); List patientTypes = createPatientTypes(); - List pids = new ArrayList<>(); + List pids = new ArrayList<>(); for (IPrimitiveType type : patientTypes) { pids.add(new JpaPid(((IdDt) type).getIdPartAsLong())); } @@ -291,16 +291,16 @@ public class JpaBulkExportProcessorTest { .thenReturn(groupResource); when(myIdHelperService.translatePidsToForcedIds(any(Set.class))) .thenAnswer(params -> { - Set uniqPids = params.getArgument(0); - HashMap> answer = new HashMap<>(); - for (ResourcePersistentId l : uniqPids) { + Set uniqPids = params.getArgument(0); + HashMap> answer = new HashMap<>(); + for (BaseResourcePersistentId l : uniqPids) { answer.put(l, Optional.empty()); } return new PersistentIdToForcedIdMap(answer); }); when(myIdHelperService.getPidOrNull(any(), any(Group.class))) .thenReturn(groupId); - when(myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(any(ResourcePersistentId.class), eq(MdmMatchResultEnum.MATCH))) + when(myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(any(BaseResourcePersistentId.class), eq(MdmMatchResultEnum.MATCH))) .thenReturn(Collections.singletonList(tuple)); when(myMdmExpansionCacheSvc.hasBeenPopulated()) .thenReturn(false); // does not matter, since if false, it then goes and populates @@ -381,13 +381,13 @@ public class JpaBulkExportProcessorTest { .thenReturn(resultIterator); if (theMdm) { - when(myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(any(ResourcePersistentId.class), eq(MdmMatchResultEnum.MATCH))) + when(myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(any(BaseResourcePersistentId.class), eq(MdmMatchResultEnum.MATCH))) .thenReturn(Collections.singletonList(tuple)); when(myIdHelperService.translatePidsToForcedIds(any(Set.class))) .thenAnswer(params -> { - Set uniqPids = params.getArgument(0); - HashMap> answer = new HashMap<>(); - for (ResourcePersistentId l : uniqPids) { + Set uniqPids = params.getArgument(0); + HashMap> answer = new HashMap<>(); + for (BaseResourcePersistentId l : uniqPids) { answer.put(l, Optional.empty()); } return new PersistentIdToForcedIdMap(answer); @@ -445,7 +445,7 @@ public class JpaBulkExportProcessorTest { assertTrue(iterator.hasNext()); int count = 0; while (iterator.hasNext()) { - ResourcePersistentId ret = iterator.next(); + BaseResourcePersistentId ret = iterator.next(); assertTrue( ret.equals(pid) || ret.equals(pid2) ); diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java index 0263c5e7251..52d0bbe2f9b 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java @@ -12,12 +12,12 @@ import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticHSearch; import ca.uhn.fhir.jpa.dao.IHSearchEventListener; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.TestDaoSearch; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -36,7 +36,7 @@ import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.ReferenceParam; import ca.uhn.fhir.rest.param.StringOrListParam; import ca.uhn.fhir.rest.param.StringParam; @@ -940,7 +940,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl SearchParameterMap map = new SearchParameterMap(); map.add("code", new TokenParam().setSystem("http://example.com")); - List bp = myObservationDao.searchForIds(map, new ServletRequestDetails()); + List bp = myObservationDao.searchForIds(map, new ServletRequestDetails()); assertNotNull(bp); assertEquals(600, bp.size()); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java index c0b31d4484e..cd77771aa42 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/dao/MdmLinkDaoSvc.java @@ -35,7 +35,7 @@ import ca.uhn.fhir.mdm.dao.MdmLinkFactory; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -95,8 +95,8 @@ public class MdmLinkDaoSvc { @Nonnull public IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(IAnyResource theGoldenResource, IAnyResource theSourceResource) { - ResourcePersistentId goldenResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); - ResourcePersistentId sourceResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); + BaseResourcePersistentId goldenResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); + BaseResourcePersistentId sourceResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); Optional oExisting = getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourcePid, sourceResourcePid); if (oExisting.isPresent()) { return oExisting.get(); @@ -126,7 +126,7 @@ public class MdmLinkDaoSvc { * @param theSourceResourcePid The ResourcepersistenceId of the Source resource * @return The {@link IMdmLink} entity that matches these criteria if exists */ - public Optional getLinkByGoldenResourcePidAndSourceResourcePid(ResourcePersistentId theGoldenResourcePid, ResourcePersistentId theSourceResourcePid) { + public Optional getLinkByGoldenResourcePidAndSourceResourcePid(BaseResourcePersistentId theGoldenResourcePid, BaseResourcePersistentId theSourceResourcePid) { if (theSourceResourcePid == null || theGoldenResourcePid == null) { return Optional.empty(); } @@ -144,7 +144,7 @@ public class MdmLinkDaoSvc { * @param theMatchResult the Match Result of the relationship * @return a list of {@link IMdmLink} entities matching these criteria. */ - public List getMdmLinksBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) { + public List getMdmLinksBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) { IMdmLink exampleLink = myMdmLinkFactory.newMdmLink(); exampleLink.setSourcePersistenceId(theSourcePid); exampleLink.setMatchResult(theMatchResult); @@ -161,7 +161,7 @@ public class MdmLinkDaoSvc { */ @Deprecated @Transactional - public Optional getMatchedLinkForSourcePid(ResourcePersistentId theSourcePid) { + public Optional getMatchedLinkForSourcePid(BaseResourcePersistentId theSourcePid) { return myMdmLinkDao.findBySourcePidAndMatchResult(theSourcePid, MdmMatchResultEnum.MATCH); } @@ -182,7 +182,7 @@ public class MdmLinkDaoSvc { @Nonnull private Optional getMdmLinkWithMatchResult(IBaseResource theSourceResource, MdmMatchResultEnum theMatchResult) { - ResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); + BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); if (pid == null) { return Optional.empty(); } @@ -207,8 +207,8 @@ public class MdmLinkDaoSvc { return getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(new JpaPid(theGoldenResourcePid), new JpaPid(theSourcePid), theMatchResult); } - public Optional getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ResourcePersistentId theGoldenResourcePid, - ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) { + public Optional getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(BaseResourcePersistentId theGoldenResourcePid, + BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) { IMdmLink exampleLink = myMdmLinkFactory.newMdmLink(); exampleLink.setGoldenResourcePersistenceId(theGoldenResourcePid); exampleLink.setSourcePersistenceId(theSourcePid); @@ -231,7 +231,7 @@ public class MdmLinkDaoSvc { @Transactional public Optional findMdmLinkBySource(IBaseResource theSourceResource) { - @Nullable ResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); + @Nullable BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); if (pid == null) { return Optional.empty(); } @@ -261,7 +261,7 @@ public class MdmLinkDaoSvc { */ @Transactional public List findMdmLinksByGoldenResource(IBaseResource theGoldenResource) { - ResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); + BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); if (pid == null) { return Collections.emptyList(); } @@ -311,7 +311,7 @@ public class MdmLinkDaoSvc { */ @Transactional public List findMdmLinksBySourceResource(IBaseResource theSourceResource) { - ResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); + BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource); if (pid == null) { return Collections.emptyList(); } @@ -329,7 +329,7 @@ public class MdmLinkDaoSvc { * @return all links for the source. */ public List findMdmMatchLinksByGoldenResource(IBaseResource theGoldenResource) { - ResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); + BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource); if (pid == null) { return Collections.emptyList(); } @@ -369,7 +369,7 @@ public class MdmLinkDaoSvc { } @Transactional(propagation = Propagation.MANDATORY) - public void deleteLinksWithAnyReferenceToPids(List theGoldenResourcePids) { + public void deleteLinksWithAnyReferenceToPids(List theGoldenResourcePids) { myMdmLinkDao.deleteLinksWithAnyReferenceToPids(theGoldenResourcePids); } } diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceMergerSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceMergerSvcImpl.java index 49492546e9a..991b8200802 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceMergerSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceMergerSvcImpl.java @@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.mdm.svc; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; -import ca.uhn.fhir.jpa.dao.index.IdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.jpa.mdm.util.MdmPartitionHelper; import ca.uhn.fhir.mdm.api.IGoldenResourceMergerSvc; @@ -36,7 +35,7 @@ import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.GoldenResourceHelper; import ca.uhn.fhir.mdm.util.MdmResourceUtil; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -141,7 +140,7 @@ public class GoldenResourceMergerSvcImpl implements IGoldenResourceMergerSvc { List fromLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theFromResource); // fromLinks - links going to theFromResource List toLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theToResource); // toLinks - links going to theToResource List toDelete = new ArrayList<>(); - ResourcePersistentId goldenResourcePid = myIdHelperService.resolveResourcePersistentIds((RequestPartitionId) theToResource.getUserData(Constants.RESOURCE_PARTITION_ID), theToResource.getIdElement().getResourceType(), theToResource.getIdElement().getIdPart()); + BaseResourcePersistentId goldenResourcePid = myIdHelperService.resolveResourcePersistentIds((RequestPartitionId) theToResource.getUserData(Constants.RESOURCE_PARTITION_ID), theToResource.getIdElement().getResourceType(), theToResource.getIdElement().getIdPart()); for (IMdmLink fromLink : fromLinks) { Optional optionalToLink = findFirstLinkWithMatchingSource(toLinks, fromLink); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceSearchSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceSearchSvcImpl.java index 135509a70d4..65273cde68e 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceSearchSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/GoldenResourceSearchSvcImpl.java @@ -35,7 +35,7 @@ import ca.uhn.fhir.mdm.api.MdmConstants; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.util.DateRangeUtil; @@ -77,7 +77,7 @@ public class GoldenResourceSearchSvcImpl implements IGoldenResourceSearchSvc { IFhirResourceDao dao = myDaoRegistry.getResourceDao(theResourceType); SystemRequestDetails request = new SystemRequestDetails(); request.setRequestPartitionId(theRequestPartitionId); - List ids = dao.searchForIds(searchParamMap, request); + List ids = dao.searchForIds(searchParamMap, request); Date lastDate = null; if (ids.size() > 0) { diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmEidUpdateService.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmEidUpdateService.java index 214b8a98778..26b5944bfc4 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmEidUpdateService.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmEidUpdateService.java @@ -20,7 +20,6 @@ package ca.uhn.fhir.jpa.mdm.svc; * #L% */ -import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.jpa.mdm.svc.candidate.MatchedGoldenResourceCandidate; import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmGoldenResourceFindingSvc; @@ -35,7 +34,7 @@ import ca.uhn.fhir.mdm.model.CanonicalEID; import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.EIDHelper; import ca.uhn.fhir.mdm.util.GoldenResourceHelper; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -168,7 +167,7 @@ public class MdmEidUpdateService { if (theExistingMatchOrPossibleMatchLink.isPresent()) { IMdmLink mdmLink = theExistingMatchOrPossibleMatchLink.get(); - ResourcePersistentId existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId(); + BaseResourcePersistentId existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId(); myExistingGoldenResource = myMdmResourceDaoSvc.readGoldenResourceByPid(existingGoldenResourcePid, resourceType); myRemainsMatchedToSameGoldenResource = candidateIsSameAsMdmLinkGoldenResource(mdmLink, theMatchedGoldenResourceCandidate); } else { diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImpl.java index 550813cb05c..2ce4d80a715 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImpl.java @@ -37,7 +37,7 @@ import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.MdmResourceUtil; import ca.uhn.fhir.mdm.util.MessageHelper; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; @@ -71,8 +71,8 @@ public class MdmLinkCreateSvcImpl implements IMdmLinkCreateSvc { validateCreateLinkRequest(theGoldenResource, theSourceResource, sourceType); - ResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); - ResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource); + BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); + BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource); // check if the golden resource and the source resource are in the same partition, throw error if not myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcImpl.java index 58be3c1f607..22cfd37cc69 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkSvcImpl.java @@ -31,18 +31,17 @@ import ca.uhn.fhir.mdm.api.MdmMatchOutcome; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.model.MdmTransactionContext; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Nonnull; -import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; /** * This class is in charge of managing MdmLinks between Golden Resources and source resources @@ -79,8 +78,8 @@ public class MdmLinkSvcImpl implements IMdmLinkSvc { } private boolean goldenResourceLinkedAsNoMatch(IAnyResource theGoldenResource, IAnyResource theSourceResource) { - ResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); - ResourcePersistentId sourceId = myIdHelperService.getPidOrThrowException(theSourceResource); + BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); + BaseResourcePersistentId sourceId = myIdHelperService.getPidOrThrowException(theSourceResource); // TODO perf collapse into one query return myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(goldenResourceId, sourceId, MdmMatchResultEnum.NO_MATCH).isPresent() || myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(sourceId, goldenResourceId, MdmMatchResultEnum.NO_MATCH).isPresent(); @@ -102,7 +101,7 @@ public class MdmLinkSvcImpl implements IMdmLinkSvc { @Override @Transactional - public void deleteLinksWithAnyReferenceTo(List theGoldenResourceIds) { + public void deleteLinksWithAnyReferenceTo(List theGoldenResourceIds) { myMdmLinkDaoSvc.deleteLinksWithAnyReferenceToPids(theGoldenResourceIds); } diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkUpdaterSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkUpdaterSvcImpl.java index a938e514503..e785c668866 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkUpdaterSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkUpdaterSvcImpl.java @@ -21,12 +21,12 @@ package ca.uhn.fhir.jpa.mdm.svc; */ import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.jpa.mdm.util.MdmPartitionHelper; import ca.uhn.fhir.jpa.model.entity.PartitionablePartitionId; -import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.IMdmLinkSvc; import ca.uhn.fhir.mdm.api.IMdmLinkUpdaterSvc; @@ -39,7 +39,7 @@ import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.MdmResourceUtil; import ca.uhn.fhir.mdm.util.MessageHelper; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.provider.ProviderConstants; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -82,8 +82,8 @@ public class MdmLinkUpdaterSvcImpl implements IMdmLinkUpdaterSvc { validateUpdateLinkRequest(theGoldenResource, theSourceResource, theMatchResult, sourceType); - ResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); - ResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource); + BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); + BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource); // check if the golden resource and the source resource are in the same partition, throw error if not myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource); @@ -158,8 +158,8 @@ public class MdmLinkUpdaterSvcImpl implements IMdmLinkUpdaterSvc { public void notDuplicateGoldenResource(IAnyResource theGoldenResource, IAnyResource theTargetGoldenResource, MdmTransactionContext theMdmContext) { validateNotDuplicateGoldenResourceRequest(theGoldenResource, theTargetGoldenResource); - ResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); - ResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theTargetGoldenResource); + BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource); + BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theTargetGoldenResource); Optional oMdmLink = myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourceId, targetId); if (!oMdmLink.isPresent()) { diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvc.java index c667d4e0b50..63898208d83 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvc.java @@ -30,14 +30,14 @@ import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.GoldenResourceHelper; import ca.uhn.fhir.mdm.util.MdmResourceUtil; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.TransactionLogMessages; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import org.springframework.transaction.annotation.Transactional; + import java.util.ArrayList; import java.util.List; @@ -93,7 +93,7 @@ public class MdmMatchLinkSvc { private void handleMdmWithMultipleCandidates(IAnyResource theResource, CandidateList theCandidateList, MdmTransactionContext theMdmTransactionContext) { MatchedGoldenResourceCandidate firstMatch = theCandidateList.getFirstMatch(); - ResourcePersistentId sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid(); + BaseResourcePersistentId sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid(); boolean allSameGoldenResource = theCandidateList.stream() .allMatch(candidate -> candidate.getCandidateGoldenResourcePid().equals(sampleGoldenResourcePid)); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmResourceDaoSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmResourceDaoSvc.java index 92b6cf52d17..b009d418b72 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmResourceDaoSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmResourceDaoSvc.java @@ -20,8 +20,8 @@ package ca.uhn.fhir.jpa.mdm.svc; * #L% */ -import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.i18n.Msg; +import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; @@ -33,7 +33,7 @@ import ca.uhn.fhir.mdm.api.MdmConstants; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -77,7 +77,7 @@ public class MdmResourceDaoSvc { resourceDao.removeTag(theGoldenResource.getIdElement(), TagTypeEnum.TAG, MdmConstants.SYSTEM_GOLDEN_RECORD_STATUS, MdmConstants.CODE_GOLDEN_RECORD, requestDetails); } - public IAnyResource readGoldenResourceByPid(ResourcePersistentId theGoldenResourcePid, String theResourceType) { + public IAnyResource readGoldenResourceByPid(BaseResourcePersistentId theGoldenResourcePid, String theResourceType) { IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theResourceType); return (IAnyResource) resourceDao.readByPid(theGoldenResourcePid); } diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByEidSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByEidSvc.java index ab7cb804138..6547e5ade83 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByEidSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByEidSvc.java @@ -30,7 +30,7 @@ import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.model.CanonicalEID; import ca.uhn.fhir.mdm.util.EIDHelper; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -66,7 +66,7 @@ public class FindCandidateByEidSvc extends BaseCandidateFinder { if (isNoMatch(foundGoldenResource, theIncomingResource)) { continue; } - ResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), foundGoldenResource); + BaseResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), foundGoldenResource); MatchedGoldenResourceCandidate mpc = new MatchedGoldenResourceCandidate(pidOrNull, MdmMatchOutcome.EID_MATCH); ourLog.debug("Incoming Resource {} matched Golden Resource {} by EID {}", theIncomingResource.getIdElement().toUnqualifiedVersionless(), foundGoldenResource.getIdElement().toUnqualifiedVersionless(), eid); diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByExampleSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByExampleSvc.java index aaa801ce30c..79a7da5626c 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByExampleSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByExampleSvc.java @@ -30,7 +30,7 @@ import ca.uhn.fhir.mdm.api.MatchedTarget; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.slf4j.Logger; @@ -66,7 +66,7 @@ public class FindCandidateByExampleSvc extends BaseCandidateFinder { protected List findMatchGoldenResourceCandidates(IAnyResource theTarget) { List retval = new ArrayList<>(); - List goldenResourcePidsToExclude = getNoMatchGoldenResourcePids(theTarget); + List goldenResourcePidsToExclude = getNoMatchGoldenResourcePids(theTarget); List matchedCandidates = myMdmMatchFinderSvc.getMatchedTargets(myFhirContext.getResourceType(theTarget), theTarget, (RequestPartitionId) theTarget.getUserData(Constants.RESOURCE_PARTITION_ID)); @@ -113,8 +113,8 @@ public class FindCandidateByExampleSvc extends BaseCandidateFinder { return retval; } - private List getNoMatchGoldenResourcePids(IBaseResource theBaseResource) { - ResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource); + private List getNoMatchGoldenResourcePids(IBaseResource theBaseResource) { + BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource); return myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(targetPid, MdmMatchResultEnum.NO_MATCH) .stream() .map(IMdmLink::getGoldenResourcePersistenceId) diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByLinkSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByLinkSvc.java index 13cceae6cd4..342cc339dec 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByLinkSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/FindCandidateByLinkSvc.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.log.Logs; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; import org.springframework.stereotype.Service; @@ -47,11 +47,11 @@ public class FindCandidateByLinkSvc extends BaseCandidateFinder { protected List findMatchGoldenResourceCandidates(IAnyResource theTarget) { List retval = new ArrayList<>(); - ResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget); + BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget); if (targetPid != null) { Optional oLink = myMdmLinkDaoSvc.getMatchedLinkForSourcePid(targetPid); if (oLink.isPresent()) { - ResourcePersistentId goldenResourcePid = oLink.get().getGoldenResourcePersistenceId(); + BaseResourcePersistentId goldenResourcePid = oLink.get().getGoldenResourcePersistenceId(); ourLog.debug("Resource previously linked. Using existing link."); retval.add(new MatchedGoldenResourceCandidate(goldenResourcePid, oLink.get())); } diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MatchedGoldenResourceCandidate.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MatchedGoldenResourceCandidate.java index 2fd17ca7a13..f5a8c833d4d 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MatchedGoldenResourceCandidate.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MatchedGoldenResourceCandidate.java @@ -22,25 +22,24 @@ package ca.uhn.fhir.jpa.mdm.svc.candidate; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.MdmMatchOutcome; -import ca.uhn.fhir.jpa.entity.MdmLink; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; public class MatchedGoldenResourceCandidate { - private final ResourcePersistentId myCandidateGoldenResourcePid; + private final BaseResourcePersistentId myCandidateGoldenResourcePid; private final MdmMatchOutcome myMdmMatchOutcome; - public MatchedGoldenResourceCandidate(ResourcePersistentId theCandidate, MdmMatchOutcome theMdmMatchOutcome) { + public MatchedGoldenResourceCandidate(BaseResourcePersistentId theCandidate, MdmMatchOutcome theMdmMatchOutcome) { myCandidateGoldenResourcePid = theCandidate; myMdmMatchOutcome = theMdmMatchOutcome; } - public MatchedGoldenResourceCandidate(ResourcePersistentId theGoldenResourcePid, IMdmLink theMdmLink) { + public MatchedGoldenResourceCandidate(BaseResourcePersistentId theGoldenResourcePid, IMdmLink theMdmLink) { myCandidateGoldenResourcePid = theGoldenResourcePid; myMdmMatchOutcome = new MdmMatchOutcome(theMdmLink.getVector(), theMdmLink.getScore()).setMatchResultEnum(theMdmLink.getMatchResult()); } - public ResourcePersistentId getCandidateGoldenResourcePid() { + public BaseResourcePersistentId getCandidateGoldenResourcePid() { return myCandidateGoldenResourcePid; } diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmCandidateSearchSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmCandidateSearchSvc.java index fb5543eae1f..725c3e1c652 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmCandidateSearchSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmCandidateSearchSvc.java @@ -20,15 +20,15 @@ package ca.uhn.fhir.jpa.mdm.svc.candidate; * #L% */ +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; -import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.rules.json.MdmFilterSearchParamJson; import ca.uhn.fhir.mdm.rules.json.MdmResourceSearchParamJson; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.slf4j.Logger; @@ -75,7 +75,7 @@ public class MdmCandidateSearchSvc { */ @Transactional public Collection findCandidates(String theResourceType, IAnyResource theResource, RequestPartitionId theRequestPartitionId) { - Map matchedPidsToResources = new HashMap<>(); + Map matchedPidsToResources = new HashMap<>(); List filterSearchParams = myMdmSettings.getMdmRules().getCandidateFilterSearchParams(); List filterCriteria = buildFilterQuery(filterSearchParams, theResourceType); List candidateSearchParams = myMdmSettings.getMdmRules().getCandidateSearchParams(); @@ -120,7 +120,7 @@ public class MdmCandidateSearchSvc { * 4. Store all results in `theMatchedPidsToResources` */ @SuppressWarnings("rawtypes") - private void searchForIdsAndAddToMap(String theResourceType, IAnyResource theResource, Map theMatchedPidsToResources, List theFilterCriteria, MdmResourceSearchParamJson resourceSearchParam, RequestPartitionId theRequestPartitionId) { + private void searchForIdsAndAddToMap(String theResourceType, IAnyResource theResource, Map theMatchedPidsToResources, List theFilterCriteria, MdmResourceSearchParamJson resourceSearchParam, RequestPartitionId theRequestPartitionId) { //1. Optional oResourceCriteria = myMdmCandidateSearchCriteriaBuilderSvc.buildResourceQueryString(theResourceType, theResource, theFilterCriteria, resourceSearchParam); if (!oResourceCriteria.isPresent()) { diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmGoldenResourceFindingSvc.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmGoldenResourceFindingSvc.java index d2040a76b97..c76ba11692d 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmGoldenResourceFindingSvc.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/candidate/MdmGoldenResourceFindingSvc.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.mdm.svc.candidate; import ca.uhn.fhir.jpa.mdm.svc.MdmResourceDaoSvc; import ca.uhn.fhir.mdm.log.Logs; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.slf4j.Logger; @@ -77,7 +77,7 @@ public class MdmGoldenResourceFindingSvc { } public IAnyResource getGoldenResourceFromMatchedGoldenResourceCandidate(MatchedGoldenResourceCandidate theMatchedGoldenResourceCandidate, String theResourceType) { - ResourcePersistentId goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid(); + BaseResourcePersistentId goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid(); return myMdmResourceDaoSvc.readGoldenResourceByPid(goldenResourcePid, theResourceType); } } diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/BaseGoldenResourceMatcher.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/BaseGoldenResourceMatcher.java index 7bcbdab19f0..03781571fed 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/BaseGoldenResourceMatcher.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/BaseGoldenResourceMatcher.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.util.MdmResourceUtil; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.TypeSafeMatcher; import org.hl7.fhir.instance.model.api.IAnyResource; import org.slf4j.Logger; @@ -35,8 +35,8 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher getPossibleMatchedGoldenResourcePidsFromTarget(IAnyResource theBaseResource) { + protected List getPossibleMatchedGoldenResourcePidsFromTarget(IAnyResource theBaseResource) { return getMdmLinksForTarget(theBaseResource, MdmMatchResultEnum.POSSIBLE_MATCH) .stream() .map(IMdmLink::getGoldenResourcePersistenceId).collect(Collectors.toList()); @@ -71,7 +71,7 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher getMdmLinksForTarget(IAnyResource theTargetResource, MdmMatchResultEnum theMatchResult) { - ResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTargetResource); + BaseResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTargetResource); List matchLinkForTarget = myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(pidOrNull, theMatchResult); if (!matchLinkForTarget.isEmpty()) { return matchLinkForTarget; diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsLinkedTo.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsLinkedTo.java index 18f9da94794..fb628045ff9 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsLinkedTo.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsLinkedTo.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.mdm.matcher; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -16,8 +16,8 @@ import java.util.stream.Collectors; */ public class IsLinkedTo extends BaseGoldenResourceMatcher { - private List baseResourceGoldenResourcePids; - private ResourcePersistentId incomingResourceGoldenResourcePid; + private List baseResourceGoldenResourcePids; + private BaseResourcePersistentId incomingResourceGoldenResourcePid; protected IsLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) { super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleDuplicateOf.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleDuplicateOf.java index bb811ef11c7..098c0c298d8 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleDuplicateOf.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleDuplicateOf.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -19,7 +19,7 @@ public class IsPossibleDuplicateOf extends BaseGoldenResourceMatcher { * Matcher with tells us if there is an MdmLink with between these two resources that are considered POSSIBLE DUPLICATE. * For use only on GoldenResource. */ - private ResourcePersistentId incomingGoldenResourcePid; + private BaseResourcePersistentId incomingGoldenResourcePid; protected IsPossibleDuplicateOf(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) { super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource); @@ -29,7 +29,7 @@ public class IsPossibleDuplicateOf extends BaseGoldenResourceMatcher { protected boolean matchesSafely(IAnyResource theIncomingResource) { incomingGoldenResourcePid = getMatchedResourcePidFromResource(theIncomingResource); - List goldenResourcePidsToMatch = myBaseResources.stream() + List goldenResourcePidsToMatch = myBaseResources.stream() .map(this::getMatchedResourcePidFromResource) .collect(Collectors.toList()); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleLinkedTo.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleLinkedTo.java index f1bfd192f95..dba3cef56a2 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleLinkedTo.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleLinkedTo.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.mdm.matcher; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -17,8 +17,8 @@ import java.util.stream.Collectors; */ public class IsPossibleLinkedTo extends BaseGoldenResourceMatcher { - private List baseResourceGoldenResourcePids; - private ResourcePersistentId incomingResourceGoldenResourcePid; + private List baseResourceGoldenResourcePids; + private BaseResourcePersistentId incomingResourceGoldenResourcePid; protected IsPossibleLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theTargetResources) { super(theIdHelperService, theMdmLinkDaoSvc, theTargetResources); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleMatchWith.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleMatchWith.java index 4ccadbe2def..0503d6b5878 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleMatchWith.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsPossibleMatchWith.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -26,7 +26,7 @@ public class IsPossibleMatchWith extends BaseGoldenResourceMatcher { protected boolean matchesSafely(IAnyResource theIncomingResource) { List mdmLinks = getMdmLinksForTarget(theIncomingResource, MdmMatchResultEnum.POSSIBLE_MATCH); - List goldenResourcePidsToMatch = myBaseResources.stream() + List goldenResourcePidsToMatch = myBaseResources.stream() .map(this::getMatchedResourcePidFromResource) .filter(Objects::nonNull) .collect(Collectors.toList()); @@ -37,7 +37,7 @@ public class IsPossibleMatchWith extends BaseGoldenResourceMatcher { .collect(Collectors.toList()); } - List mdmLinkGoldenResourcePids = mdmLinks + List mdmLinkGoldenResourcePids = mdmLinks .stream().map(IMdmLink::getGoldenResourcePersistenceId) .collect(Collectors.toList()); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsSameGoldenResourceAs.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsSameGoldenResourceAs.java index 24ecc201afd..ee4c3825577 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsSameGoldenResourceAs.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/matcher/IsSameGoldenResourceAs.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.mdm.matcher; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hl7.fhir.instance.model.api.IAnyResource; @@ -12,8 +12,8 @@ import java.util.stream.Collectors; public class IsSameGoldenResourceAs extends BaseGoldenResourceMatcher { - private List goldenResourcePidsToMatch; - private ResourcePersistentId incomingGoldenResourcePid; + private List goldenResourcePidsToMatch; + private BaseResourcePersistentId incomingGoldenResourcePid; public IsSameGoldenResourceAs(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) { super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImplTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImplTest.java index 71c6bd2b251..7ea4cd9f1b3 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImplTest.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmLinkCreateSvcImplTest.java @@ -2,10 +2,10 @@ package ca.uhn.fhir.jpa.mdm.svc; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc; import ca.uhn.fhir.jpa.mdm.util.MdmPartitionHelper; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum; @@ -13,7 +13,7 @@ import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.model.MdmTransactionContext; import ca.uhn.fhir.mdm.util.MdmResourceUtil; import ca.uhn.fhir.mdm.util.MessageHelper; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.r4.model.Patient; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -78,8 +78,8 @@ class MdmLinkCreateSvcImplTest { JpaPid sourceId = new JpaPid(2L); when(myIdHelperService.getPidOrThrowException(any())) .thenReturn(goldenId, sourceId); - when(myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(any(ResourcePersistentId.class), any(ResourcePersistentId.class))).thenReturn(Optional.empty()); - when(myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(any(ResourcePersistentId.class), any())).thenReturn(new ArrayList<>()); + when(myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(any(BaseResourcePersistentId.class), any(BaseResourcePersistentId.class))).thenReturn(Optional.empty()); + when(myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(any(BaseResourcePersistentId.class), any())).thenReturn(new ArrayList<>()); MdmLink resultMdmLink = new MdmLink(); resultMdmLink.setGoldenResourcePersistenceId(goldenId).setSourcePersistenceId(sourceId); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcMultipleEidModeTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcMultipleEidModeTest.java index 2c084f27a3f..2832f94830d 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcMultipleEidModeTest.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcMultipleEidModeTest.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test; import ca.uhn.fhir.mdm.api.MdmConstants; import ca.uhn.fhir.mdm.model.CanonicalEID; import ca.uhn.fhir.mdm.util.EIDHelper; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Patient; @@ -147,7 +147,7 @@ public class MdmMatchLinkSvcMultipleEidModeTest extends BaseMdmR4Test { Patient finalPatient1 = patient1; Patient finalPatient2 = patient2; - List duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2) + List duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2) .map(t -> myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), getGoldenResourceFromTargetResource(t))) .collect(Collectors.toList())); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java index c8be3e88499..dbcc04108e2 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java @@ -1,9 +1,9 @@ package ca.uhn.fhir.jpa.mdm.svc; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.mdm.api.IMdmLink; import ca.uhn.fhir.mdm.api.IMdmLinkSvc; @@ -17,7 +17,7 @@ import ca.uhn.fhir.mdm.util.EIDHelper; import ca.uhn.fhir.mdm.util.GoldenResourceHelper; import ca.uhn.fhir.mdm.util.MdmResourceUtil; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.TokenParam; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.r4.model.HumanName; @@ -277,7 +277,7 @@ public class MdmMatchLinkSvcTest extends BaseMdmR4Test { Patient finalPatient1 = patient1; Patient finalPatient2 = patient2; - List duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2) + List duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2) .map(t -> myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), getGoldenResourceFromTargetResource(t))) .collect(Collectors.toList())); diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java index 6781f7f9a61..38d13d6aa3e 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java @@ -20,11 +20,11 @@ package ca.uhn.fhir.jpa.model.cross; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.Date; -public interface IResourceLookup { +public interface IResourceLookup { String getResourceType(); /** diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dao/JpaPid.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dao/JpaPid.java index 64c350fac71..09ef5831109 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dao/JpaPid.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dao/JpaPid.java @@ -1,13 +1,13 @@ package ca.uhn.fhir.jpa.model.dao; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; -public class JpaPid extends ResourcePersistentId { +public class JpaPid extends BaseResourcePersistentId { private final Long myId; public JpaPid(Long theId) { diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java index d0ea969076a..795f37cd3e8 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java @@ -29,7 +29,7 @@ import ca.uhn.fhir.jpa.model.search.ResourceTableRoutingBinder; import ca.uhn.fhir.jpa.model.search.SearchParamTextPropertyBinder; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.hibernate.Session; @@ -768,7 +768,7 @@ public class ResourceTable extends BaseHasResource implements Serializable, IBas } @Override - public ResourcePersistentId getPersistentId() { + public BaseResourcePersistentId getPersistentId() { return new JpaPid(getId()); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java index 777de773b96..6ba46778a86 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.cache; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IIdType; import java.util.HashMap; @@ -28,15 +28,15 @@ import java.util.List; import java.util.Map; public class ResourcePersistentIdMap { - private final Map myMap = new HashMap<>(); + private final Map myMap = new HashMap<>(); - public static ResourcePersistentIdMap fromResourcePersistentIds(List theResourcePersistentIds) { + public static ResourcePersistentIdMap fromResourcePersistentIds(List theResourcePersistentIds) { ResourcePersistentIdMap retval = new ResourcePersistentIdMap(); theResourcePersistentIds.forEach(retval::add); return retval; } - private void add(ResourcePersistentId theResourcePersistentId) { + private void add(BaseResourcePersistentId theResourcePersistentId) { IIdType id = theResourcePersistentId.getAssociatedResourceId(); myMap.put(id.toUnqualifiedVersionless(), theResourcePersistentId); } @@ -45,7 +45,7 @@ public class ResourcePersistentIdMap { return myMap.containsKey(theId.toUnqualifiedVersionless()); } - public ResourcePersistentId getResourcePersistentId(IIdType theId) { + public BaseResourcePersistentId getResourcePersistentId(IIdType theId) { return myMap.get(theId.toUnqualifiedVersionless()); } @@ -57,7 +57,7 @@ public class ResourcePersistentIdMap { return myMap.size(); } - public void put(IIdType theId, ResourcePersistentId thePid) { + public void put(IIdType theId, BaseResourcePersistentId thePid) { myMap.put(theId, thePid); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java index f32ecbcf3fd..c1f676d2634 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java @@ -48,7 +48,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; @@ -390,7 +390,7 @@ public class SearchParamExtractorService { } IIdType referenceElement = thePathAndRef.getRef().getReferenceElement(); - ResourcePersistentId resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement); + BaseResourcePersistentId resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement); ResourceLink resourceLink; Long targetVersionId = nextId.getVersionIdPartAsLong(); diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java index 2f96baac54e..6c4f73b850c 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java @@ -41,7 +41,7 @@ import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum; import ca.uhn.fhir.rest.annotation.IdParam; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; @@ -335,12 +335,12 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc toIndex = Math.min(toIndex, theJobDetails.getCurrentSearchCount()); } ourLog.info("Triggering job[{}] search {} requesting resources {} - {}", theJobDetails.getJobId(), theJobDetails.getCurrentSearchUuid(), fromIndex, toIndex); - List resourceIds = mySearchCoordinatorSvc.getResources(theJobDetails.getCurrentSearchUuid(), fromIndex, toIndex, null); + List resourceIds = mySearchCoordinatorSvc.getResources(theJobDetails.getCurrentSearchUuid(), fromIndex, toIndex, null); ourLog.info("Triggering job[{}] delivering {} resources", theJobDetails.getJobId(), resourceIds.size()); int highestIndexSubmitted = theJobDetails.getCurrentSearchLastUploadedIndex(); - for (ResourcePersistentId next : resourceIds) { + for (BaseResourcePersistentId next : resourceIds) { IBaseResource nextResource = resourceDao.readByPid(next); Future future = submitResource(theJobDetails.getSubscriptionId(), nextResource); futures.add(Pair.of(nextResource.getIdElement().getIdPart(), future)); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java index dfb6fe1b254..18ce050ce4c 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java @@ -56,7 +56,7 @@ import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.CompositeParam; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; @@ -95,7 +95,6 @@ import static org.hamcrest.Matchers.containsInRelativeOrder; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.not; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -1616,7 +1615,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test { String methodName = "testSearchValueQuantity"; QuantityParam param; - List found; + List found; param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null); found = myObservationDao.searchForIds(new SearchParameterMap("value-quantity", param), null); int initialSize = found.size(); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java index ec3f63f9d15..bda3e8bf086 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java @@ -57,7 +57,7 @@ import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.ValidationModeEnum; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.ParamPrefixEnum; @@ -1497,7 +1497,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { "}\n"; //@formatter:on - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); Organization org = myFhirContext.newJsonParser().parseResource(Organization.class, inputStr); @@ -2688,7 +2688,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { assertThat(str.length(), greaterThan(ResourceIndexedSearchParamString.MAX_LENGTH)); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); @@ -2803,7 +2803,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { String subStr1 = longStr1.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); String subStr2 = longStr2.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new IdentifierDt(subStr1, subStr2)), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new IdentifierDt(subStr1, subStr2)), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java index 6d65fe4cb32..58c2c4f47c9 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java @@ -10,7 +10,7 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.search.builder.SearchBuilder; import ca.uhn.fhir.jpa.util.BaseIterator; import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.mockito.Mock; import org.mockito.Spy; @@ -67,7 +67,7 @@ public class BaseSearchSvc { return theInvocation -> { List pids = (List) theInvocation.getArguments()[0]; List resources = (List) theInvocation.getArguments()[2]; - for (ResourcePersistentId nextPid : pids) { + for (BaseResourcePersistentId nextPid : pids) { Patient pt = new Patient(); pt.setId(nextPid.toString()); resources.add(pt); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java index d2fc1c60a04..f601b41aabd 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java @@ -23,7 +23,7 @@ import ca.uhn.fhir.jpa.util.BaseIterator; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.server.IPagingProvider; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -463,7 +463,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ } when(mySearchResultCacheSvc.fetchResultPids(any(Search.class), anyInt(), anyInt())).thenAnswer(theInvocation -> { - ArrayList results = new ArrayList<>(); + ArrayList results = new ArrayList<>(); for (long i = theInvocation.getArgument(1, Integer.class); i < theInvocation.getArgument(2, Integer.class); i++) { Long nextPid = i + 10L; results.add(new JpaPid(nextPid)); @@ -671,7 +671,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ private final IResultIterator myResultIteratorWrap; private final int myDelay; private final Iterator myWrap; - private final List myReturnedValues = new ArrayList<>(); + private final List myReturnedValues = new ArrayList<>(); private final AtomicInteger myCountReturned = new AtomicInteger(0); SlowIterator(Iterator theWrap, int theDelay) { @@ -680,7 +680,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ myResultIteratorWrap = null; } - List getReturnedValues() { + List getReturnedValues() { return myReturnedValues; } diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java index 1152a916b49..bd92fd37df0 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java @@ -27,7 +27,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.ParamPrefixEnum; @@ -2037,7 +2037,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { "}\n"; //@formatter:on - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); Organization org = myFhirContext.newJsonParser().parseResource(Organization.class, inputStr); @@ -3288,7 +3288,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { assertThat(str.length(), greaterThan(ResourceIndexedSearchParamString.MAX_LENGTH)); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); @@ -3467,7 +3467,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { String subStr1 = longStr1.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); String subStr2 = longStr2.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java index 31b5cabca4d..2b64dd49f1c 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java @@ -32,7 +32,7 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.DateRangeParam; import ca.uhn.fhir.rest.param.HasParam; @@ -2486,7 +2486,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { "}\n"; //@formatter:on - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); Organization org = myFhirContext.newJsonParser().parseResource(Organization.class, inputStr); @@ -3981,7 +3981,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { assertThat(str.length(), greaterThan(ResourceIndexedSearchParamString.MAX_LENGTH)); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); @@ -4160,7 +4160,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { String subStr1 = longStr1.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); String subStr2 = longStr2.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); - List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null); + List val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null); int initial = val.size(); myOrganizationDao.create(org, mySrd); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java index 8287f06756f..fcac5645c9e 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java @@ -7,7 +7,7 @@ import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.rest.api.MethodOutcome; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.provider.ProviderConstants; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -116,7 +116,7 @@ public class HookInterceptorR4Test extends BaseResourceProviderR4Test { IIdType savedPatientId = myClient.create().resource(new Patient()).execute().getId(); runInTransaction(() -> { - List pids = myIdHelperService.resolveResourcePersistentIdsWithCache(null, + List pids = myIdHelperService.resolveResourcePersistentIdsWithCache(null, Collections.singletonList(savedPatientId)); Long savedPatientPid = ((JpaPid) pids.get(0)).getId(); assertEquals(savedPatientPid.longValue(), pid.get()); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java index ee878686ec3..c79ca238152 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java @@ -47,7 +47,6 @@ import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermReadSvc; import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet; import ca.uhn.fhir.parser.StrictErrorHandler; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java index cff7ac2a2be..a1f80586892 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.expunge; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.test.concurrency.PointcutLatch; import com.google.common.collect.Sets; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -36,8 +36,8 @@ public class PartitionRunnerTest { @Test public void emptyList() { - List resourceIds = buildPidList(0); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + List resourceIds = buildPidList(0); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(0); getPartitionRunner().runInPartitionedThreads(resourceIds, partitionConsumer); @@ -56,8 +56,8 @@ public class PartitionRunnerTest { return new PartitionRunner("TEST", "test", theBatchSize, theThreadCount); } - private List buildPidList(int size) { - List list = new ArrayList<>(); + private List buildPidList(int size) { + List list = new ArrayList<>(); for (long i = 0; i < size; ++i) { list.add(new JpaPid(i + 1)); } @@ -66,9 +66,9 @@ public class PartitionRunnerTest { @Test public void oneItem() throws InterruptedException { - List resourceIds = buildPidList(1); + List resourceIds = buildPidList(1); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(1); getPartitionRunner().runInPartitionedThreads(resourceIds, partitionConsumer); PartitionCall partitionCall = (PartitionCall) PointcutLatch.getLatchInvocationParameter(myLatch.awaitExpected()); @@ -79,9 +79,9 @@ public class PartitionRunnerTest { @Test public void twoItems() throws InterruptedException { - List resourceIds = buildPidList(2); + List resourceIds = buildPidList(2); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(1); getPartitionRunner().runInPartitionedThreads(resourceIds, partitionConsumer); PartitionCall partitionCall = (PartitionCall) PointcutLatch.getLatchInvocationParameter(myLatch.awaitExpected()); @@ -91,9 +91,9 @@ public class PartitionRunnerTest { @Test public void tenItemsBatch5() throws InterruptedException { - List resourceIds = buildPidList(10); + List resourceIds = buildPidList(10); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(2); getPartitionRunner(5).runInPartitionedThreads(resourceIds, partitionConsumer); List calls = myLatch.awaitExpected(); @@ -108,13 +108,13 @@ public class PartitionRunnerTest { @Test public void nineItemsBatch5() throws InterruptedException { - List resourceIds = buildPidList(9); + List resourceIds = buildPidList(9); // We don't care in which order, but one partition size should be // 5 and one should be 4 Set nums = Sets.newHashSet(5, 4); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(2); getPartitionRunner(5).runInPartitionedThreads(resourceIds, partitionConsumer); List calls = myLatch.awaitExpected(); @@ -129,9 +129,9 @@ public class PartitionRunnerTest { @Test public void tenItemsOneThread() throws InterruptedException { - List resourceIds = buildPidList(10); + List resourceIds = buildPidList(10); - Consumer> partitionConsumer = buildPartitionConsumer(myLatch); + Consumer> partitionConsumer = buildPartitionConsumer(myLatch); myLatch.setExpectedCount(2); getPartitionRunner(5, 1).runInPartitionedThreads(resourceIds, partitionConsumer); List calls = myLatch.awaitExpected(); @@ -147,7 +147,7 @@ public class PartitionRunnerTest { } } - private Consumer> buildPartitionConsumer(PointcutLatch latch) { + private Consumer> buildPartitionConsumer(PointcutLatch latch) { return list -> latch.call(new PartitionCall(Thread.currentThread().getName(), list.size())); } diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/index/ResourceVersionSvcTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/index/ResourceVersionSvcTest.java index 54d89479d9e..e06ea81369b 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/index/ResourceVersionSvcTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/index/ResourceVersionSvcTest.java @@ -5,12 +5,12 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.cache.ResourcePersistentIdMap; import ca.uhn.fhir.jpa.cache.ResourceVersionSvcDaoImpl; -import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; +import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ForcedId; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -88,7 +88,7 @@ public class ResourceVersionSvcTest { * @param theResourcePacks */ private void mockReturnsFor_getIdsOfExistingResources(ResourceIdPackage... theResourcePacks) { - List resourcePersistentIds = new ArrayList<>(); + List resourcePersistentIds = new ArrayList<>(); List matches = new ArrayList<>(); for (ResourceIdPackage pack : theResourcePacks) { @@ -101,7 +101,7 @@ public class ResourceVersionSvcTest { )); } - ResourcePersistentId first = resourcePersistentIds.remove(0); + BaseResourcePersistentId first = resourcePersistentIds.remove(0); if (resourcePersistentIds.isEmpty()) { when(myIdHelperService.resolveResourcePersistentIdsWithCache(any(), any())).thenReturn(Collections.singletonList(first)); } else { @@ -114,7 +114,7 @@ public class ResourceVersionSvcTest { IIdType type = new IdDt("Patient/RED"); JpaPid jpaPid = new JpaPid(1L); jpaPid.setAssociatedResourceId(type); - HashMap map = new HashMap<>(); + HashMap map = new HashMap<>(); map.put(type, jpaPid); ResourceIdPackage pack = new ResourceIdPackage(type, jpaPid, 2L); @@ -197,11 +197,11 @@ public class ResourceVersionSvcTest { // helper class to package up data for helper methods private class ResourceIdPackage { public IIdType MyResourceId; - public ResourcePersistentId MyPid; + public BaseResourcePersistentId MyPid; public Long MyVersion; public ResourceIdPackage(IIdType id, - ResourcePersistentId pid, + BaseResourcePersistentId pid, Long version) { MyResourceId = id; MyPid = pid; diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLink.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLink.java index df5b33394ce..320f5f45091 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLink.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLink.java @@ -21,11 +21,11 @@ package ca.uhn.fhir.mdm.api; */ import ca.uhn.fhir.jpa.model.entity.PartitionablePartitionId; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.Date; -public interface IMdmLink { +public interface IMdmLink { T getId(); IMdmLink setId(T theId); diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkExpandSvc.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkExpandSvc.java index 41c6139ba0e..45da7e72146 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkExpandSvc.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkExpandSvc.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.mdm.api; */ import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -32,11 +32,11 @@ public interface IMdmLinkExpandSvc { Set expandMdmBySourceResourceId(IIdType theId); - Set expandMdmBySourceResourcePid(ResourcePersistentId theSourceResourcePid); + Set expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid); - Set expandMdmByGoldenResourceId(ResourcePersistentId theGoldenResourcePid); + Set expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid); - Set expandMdmByGoldenResourcePid(ResourcePersistentId theGoldenResourcePid); + Set expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid); Set expandMdmByGoldenResourceId(IdDt theId); } diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkSvc.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkSvc.java index 853f7e3d19e..59b2ba5b4d4 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkSvc.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/api/IMdmLinkSvc.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.mdm.api; */ import ca.uhn.fhir.mdm.model.MdmTransactionContext; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IAnyResource; import java.util.List; @@ -53,5 +53,5 @@ public interface IMdmLinkSvc { * Delete all link records whose source or target points to the provided pids. * @param thePersistentIds */ - void deleteLinksWithAnyReferenceTo(List thePersistentIds); + void deleteLinksWithAnyReferenceTo(List thePersistentIds); } diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/dao/IMdmLinkDao.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/dao/IMdmLinkDao.java index 1e3dd6eb4bc..f25ea140f05 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/dao/IMdmLinkDao.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/dao/IMdmLinkDao.java @@ -25,12 +25,11 @@ import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.api.paging.MdmPageRequest; import ca.uhn.fhir.mdm.model.MdmPidTuple; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import org.hl7.fhir.instance.model.api.IIdType; import org.springframework.data.domain.Example; import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import java.util.Date; @@ -38,23 +37,23 @@ import java.util.List; import java.util.Optional; public interface IMdmLinkDao { - int deleteWithAnyReferenceToPid(ResourcePersistentId thePid); + int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid); - int deleteWithAnyReferenceToPidAndMatchResultNot(ResourcePersistentId thePid, MdmMatchResultEnum theMatchResult); + int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult); - List expandPidsFromGroupPidGivenMatchResult(ResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum); + List expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum); - List expandPidsBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum); + List expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum); - List expandPidsByGoldenResourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum); + List expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum); - List findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable); + List findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable); - List findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold,List thePartitionIds, Pageable thePageable); + List findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List thePartitionIds, Pageable thePageable); - List findAllById(List thePids); + List findAllById(List thePids); - Optional findById(ResourcePersistentId thePid); + Optional findById(BaseResourcePersistentId thePid); void deleteAll(List theLinks); @@ -76,7 +75,7 @@ public interface IMdmLinkDao { Page search(IIdType theGoldenResourceId, IIdType theSourceId, MdmMatchResultEnum theMatchResult, MdmLinkSourceEnum theLinkSource, MdmPageRequest thePageRequest, List thePartitionId); - Optional findBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch); + Optional findBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch); - void deleteLinksWithAnyReferenceToPids(List theResourcePersistentIds); + void deleteLinksWithAnyReferenceToPids(List theResourcePersistentIds); } diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/model/MdmPidTuple.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/model/MdmPidTuple.java index b0abf4e7f23..e7626abb9eb 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/model/MdmPidTuple.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/model/MdmPidTuple.java @@ -20,9 +20,9 @@ package ca.uhn.fhir.mdm.model; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; -public class MdmPidTuple { +public class MdmPidTuple { private T myGoldenPid; private T mySourcePid; diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkDeleteSvc.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkDeleteSvc.java index d1f40ef7d01..403fd1b2324 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkDeleteSvc.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkDeleteSvc.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.dao.IMdmLinkDao; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class MdmLinkDeleteSvc { * @return the number of records deleted */ public int deleteWithAnyReferenceTo(IBaseResource theResource) { - ResourcePersistentId pid = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theResource.getIdElement()); + BaseResourcePersistentId pid = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theResource.getIdElement()); int removed = myMdmLinkDao.deleteWithAnyReferenceToPid(pid); if (removed > 0) { ourLog.info("Removed {} MDM links with references to {}", removed, theResource.getIdElement().toVersionless()); @@ -56,7 +56,7 @@ public class MdmLinkDeleteSvc { } public int deleteNonRedirectWithAnyReferenceTo(IBaseResource theResource) { - ResourcePersistentId pid = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theResource.getIdElement()); + BaseResourcePersistentId pid = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theResource.getIdElement()); int removed = myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(pid, MdmMatchResultEnum.REDIRECT); if (removed > 0) { ourLog.info("Removed {} non-redirect MDM links with references to {}", removed, theResource.getIdElement().toVersionless()); diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkExpandSvc.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkExpandSvc.java index fccb955aa33..a026d2b68ff 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkExpandSvc.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmLinkExpandSvc.java @@ -22,13 +22,13 @@ package ca.uhn.fhir.mdm.svc; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; +import ca.uhn.fhir.mdm.api.IMdmLinkExpandSvc; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.dao.IMdmLinkDao; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.mdm.model.MdmPidTuple; -import ca.uhn.fhir.mdm.api.IMdmLinkExpandSvc; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.slf4j.Logger; @@ -40,7 +40,6 @@ import javax.annotation.Nonnull; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; @Service @Transactional @@ -89,7 +88,7 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc { * @return A set of strings representing the FHIR ids of the expanded resources. */ @Override - public Set expandMdmBySourceResourcePid(ResourcePersistentId theSourceResourcePid) { + public Set expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid) { ourLog.debug("About to expand source resource with PID {}", theSourceResourcePid); List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsBySourcePidAndMatchResult(theSourceResourcePid, MdmMatchResultEnum.MATCH); return flattenPidTuplesToSet(theSourceResourcePid, goldenPidSourcePidTuples); @@ -103,7 +102,7 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc { * @return A set of strings representing the FHIR ids of the expanded resources. */ @Override - public Set expandMdmByGoldenResourceId(ResourcePersistentId theGoldenResourcePid) { + public Set expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid) { ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid); List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH); return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples); @@ -118,7 +117,7 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc { * @return A set of strings representing the FHIR ids of the expanded resources. */ @Override - public Set expandMdmByGoldenResourcePid(ResourcePersistentId theGoldenResourcePid) { + public Set expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid) { ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid); List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH); return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples); @@ -127,13 +126,13 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc { @Override public Set expandMdmByGoldenResourceId(IdDt theId) { ourLog.debug("About to expand golden resource with golden resource id {}", theId); - ResourcePersistentId pidOrThrowException = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theId); + BaseResourcePersistentId pidOrThrowException = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theId); return expandMdmByGoldenResourcePid(pidOrThrowException); } @Nonnull - public Set flattenPidTuplesToSet(ResourcePersistentId initialPid, List goldenPidSourcePidTuples) { - Set flattenedPids = new HashSet<>(); + public Set flattenPidTuplesToSet(BaseResourcePersistentId initialPid, List goldenPidSourcePidTuples) { + Set flattenedPids = new HashSet<>(); goldenPidSourcePidTuples.forEach(tuple -> { flattenedPids.add(tuple.getSourcePid()); flattenedPids.add(tuple.getGoldenPid()); diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmSubmitSvcImpl.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmSubmitSvcImpl.java index 512d1b413fa..2d97621b311 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmSubmitSvcImpl.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/svc/MdmSubmitSvcImpl.java @@ -34,7 +34,7 @@ import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.IMdmSubmitSvc; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.provider.ProviderConstants; @@ -112,7 +112,7 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc { SearchRuntimeDetails searchRuntimeDetails = new SearchRuntimeDetails(null, UUID.randomUUID().toString()); long total = 0; try (IResultIterator query = theSearchBuilder.createQuery(theSpMap, searchRuntimeDetails, null, theRequestPartitionId)) { - Collection pidBatch; + Collection pidBatch; do { pidBatch = query.getNextResultBatch(myBufferSize); total += loadPidsAndSubmitToMdmChannel(theSearchBuilder, pidBatch); @@ -133,7 +133,7 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc { * * @return The total count of submitted resources. */ - private long loadPidsAndSubmitToMdmChannel(ISearchBuilder theSearchBuilder, Collection thePidsToSubmit) { + private long loadPidsAndSubmitToMdmChannel(ISearchBuilder theSearchBuilder, Collection thePidsToSubmit) { List resourcesToSubmit = new ArrayList<>(); theSearchBuilder.loadResourcesByPid(thePidsToSubmit, Collections.emptyList(), resourcesToSubmit, false, null); ourLog.info("Submitting {} resources to MDM", resourcesToSubmit.size()); diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/ResourcePersistentId.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/BaseResourcePersistentId.java similarity index 84% rename from hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/ResourcePersistentId.java rename to hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/BaseResourcePersistentId.java index 5c8c315b4a4..f0b3fb281fa 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/ResourcePersistentId.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/BaseResourcePersistentId.java @@ -28,8 +28,8 @@ import java.util.Objects; * This class is an abstraction for however primary keys are stored in the underlying storage engine. This might be * a Long, a String, or something else. */ -public abstract class ResourcePersistentId { - public static final ResourcePersistentId NOT_FOUND = new NotFoundPid(); +public abstract class BaseResourcePersistentId { + public static final BaseResourcePersistentId NOT_FOUND = new NotFoundPid(); private Long myVersion; private final String myResourceType; // TODO KHS can this be final? @@ -39,7 +39,7 @@ public abstract class ResourcePersistentId { /** * @deprecated use subclass */ - protected ResourcePersistentId(String theResourceType) { + protected BaseResourcePersistentId(String theResourceType) { myResourceType = theResourceType; } @@ -49,7 +49,7 @@ public abstract class ResourcePersistentId { * @param theResourceType * @deprecated use subclass */ - protected ResourcePersistentId(Long theVersion, String theResourceType) { + protected BaseResourcePersistentId(Long theVersion, String theResourceType) { myVersion = theVersion; myResourceType = theResourceType; } @@ -58,7 +58,7 @@ public abstract class ResourcePersistentId { return myAssociatedResourceId; } - public ResourcePersistentId setAssociatedResourceId(IIdType theAssociatedResourceId) { + public BaseResourcePersistentId setAssociatedResourceId(IIdType theAssociatedResourceId) { myAssociatedResourceId = theAssociatedResourceId; return this; } @@ -67,7 +67,7 @@ public abstract class ResourcePersistentId { public boolean equals(Object theO) { if (this == theO) return true; if (theO == null || getClass() != theO.getClass()) return false; - ResourcePersistentId that = (ResourcePersistentId) theO; + BaseResourcePersistentId that = (BaseResourcePersistentId) theO; return Objects.equals(myVersion, that.myVersion); } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/NotFoundPid.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/NotFoundPid.java index 833ee5c657c..8598ce49c71 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/NotFoundPid.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/NotFoundPid.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.rest.api.server.storage; -public class NotFoundPid extends ResourcePersistentId { +public class NotFoundPid extends BaseResourcePersistentId { public NotFoundPid() { super(null); } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/TransactionDetails.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/TransactionDetails.java index 71df25b9b28..3269a245320 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/TransactionDetails.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/api/server/storage/TransactionDetails.java @@ -54,12 +54,12 @@ import java.util.function.Supplier; */ public class TransactionDetails { - public static final ResourcePersistentId NOT_FOUND = ResourcePersistentId.NOT_FOUND; + public static final BaseResourcePersistentId NOT_FOUND = BaseResourcePersistentId.NOT_FOUND; private final Date myTransactionDate; private List myRollbackUndoActions = Collections.emptyList(); - private Map myResolvedResourceIds = Collections.emptyMap(); - private Map myResolvedMatchUrls = Collections.emptyMap(); + private Map myResolvedResourceIds = Collections.emptyMap(); + private Map myResolvedMatchUrls = Collections.emptyMap(); private Map myUserData; private ListMultimap myDeferredInterceptorBroadcasts; private EnumSet myDeferredInterceptorBroadcastPointcuts; @@ -118,7 +118,7 @@ public class TransactionDetails { * the TransactionDetails if they are known to exist and be valid targets for other resources to link to. */ @Nullable - public ResourcePersistentId getResolvedResourceId(IIdType theId) { + public BaseResourcePersistentId getResolvedResourceId(IIdType theId) { String idValue = theId.toUnqualifiedVersionless().getValue(); return myResolvedResourceIds.get(idValue); } @@ -141,7 +141,7 @@ public class TransactionDetails { * "Observation/123") and a storage ID for that resource. Resources should only be placed within * the TransactionDetails if they are known to exist and be valid targets for other resources to link to. */ - public void addResolvedResourceId(IIdType theResourceId, @Nullable ResourcePersistentId thePersistentId) { + public void addResolvedResourceId(IIdType theResourceId, @Nullable BaseResourcePersistentId thePersistentId) { assert theResourceId != null; if (myResolvedResourceIds.isEmpty()) { @@ -150,7 +150,7 @@ public class TransactionDetails { myResolvedResourceIds.put(theResourceId.toVersionless().getValue(), thePersistentId); } - public Map getResolvedMatchUrls() { + public Map getResolvedMatchUrls() { return myResolvedMatchUrls; } @@ -159,7 +159,7 @@ public class TransactionDetails { * "Observation/123") and a storage ID for that resource. Resources should only be placed within * the TransactionDetails if they are known to exist and be valid targets for other resources to link to. */ - public void addResolvedMatchUrl(String theConditionalUrl, @Nonnull ResourcePersistentId thePersistentId) { + public void addResolvedMatchUrl(String theConditionalUrl, @Nonnull BaseResourcePersistentId thePersistentId) { Validate.notBlank(theConditionalUrl); Validate.notNull(thePersistentId); @@ -172,7 +172,7 @@ public class TransactionDetails { myResolvedMatchUrls.put(theConditionalUrl, thePersistentId); } - private boolean matchUrlWithDiffIdExists(String theConditionalUrl, @Nonnull ResourcePersistentId thePersistentId) { + private boolean matchUrlWithDiffIdExists(String theConditionalUrl, @Nonnull BaseResourcePersistentId thePersistentId) { if (myResolvedMatchUrls.containsKey(theConditionalUrl) && myResolvedMatchUrls.get(theConditionalUrl) != NOT_FOUND) { return myResolvedMatchUrls.get(theConditionalUrl).getId() != thePersistentId.getId(); } diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java index c814861a3bf..f96821e9926 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java @@ -25,9 +25,9 @@ import ca.uhn.fhir.batch2.api.IJobStepWorker; import ca.uhn.fhir.batch2.api.JobExecutionFailedException; import ca.uhn.fhir.batch2.api.RunOutcome; import ca.uhn.fhir.batch2.api.StepExecutionDetails; +import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; import ca.uhn.fhir.batch2.jobs.export.models.ExpandedResourcesList; import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; -import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; import ca.uhn.fhir.batch2.jobs.models.Id; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; @@ -36,7 +36,6 @@ import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.parser.IParser; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; @@ -46,7 +45,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import javax.annotation.Nonnull; -import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStep.java index a76b0b77987..9a8b2eec66f 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStep.java @@ -31,10 +31,9 @@ import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; import ca.uhn.fhir.batch2.jobs.models.Id; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -81,14 +80,14 @@ public class FetchResourceIdsStep implements IFirstJobStepWorker pidIterator = myBulkExportProcessor.getResourcePidIterator(providerParams); + Iterator pidIterator = myBulkExportProcessor.getResourcePidIterator(providerParams); List idsToSubmit = new ArrayList<>(); if (!pidIterator.hasNext()) { ourLog.debug("Bulk Export generated an iterator with no results!"); } while (pidIterator.hasNext()) { - ResourcePersistentId pid = pidIterator.next(); + BaseResourcePersistentId pid = pidIterator.next(); Id id; if (pid.getResourceType() != null) { diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/ConsumeFilesStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/ConsumeFilesStep.java index fe8f3281e90..04cd1a904d1 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/ConsumeFilesStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/ConsumeFilesStep.java @@ -38,7 +38,7 @@ import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; @@ -123,8 +123,8 @@ public class ConsumeFilesStep implements ILastJobStepWorker idsList = new ArrayList<>(ids.keySet()); - List resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true); - for (ResourcePersistentId next : resolvedIds) { + List resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true); + for (BaseResourcePersistentId next : resolvedIds) { IIdType resId = next.getAssociatedResourceId(); theTransactionDetails.addResolvedResourceId(resId, next); ids.remove(resId); diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/models/Id.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/models/Id.java index 9009d11f30f..59ab04fc614 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/models/Id.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/models/Id.java @@ -22,11 +22,10 @@ package ca.uhn.fhir.batch2.jobs.models; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.model.api.IModelJson; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.hl7.fhir.r4.model.IdType; public class Id implements IModelJson { @@ -76,7 +75,7 @@ public class Id implements IModelJson { return new HashCodeBuilder(17, 37).append(myResourceType).append(myId).toHashCode(); } - public static Id getIdFromPID(ResourcePersistentId thePID, String theResourceType) { + public static Id getIdFromPID(BaseResourcePersistentId thePID, String theResourceType) { Id id = new Id(); id.setId(((JpaPid)thePID).getId().toString()); id.setResourceType(theResourceType); diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexStep.java index 5a6e65c6224..8525c9f4cd0 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexStep.java @@ -35,7 +35,7 @@ import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.util.StopWatch; @@ -61,7 +61,7 @@ public class ReindexStep implements IJobStepWorker myIdHelperService; + private IIdHelperService myIdHelperService; @Nonnull @Override @@ -103,7 +103,7 @@ public class ReindexStep implements IJobStepWorker persistentIds = myData.getResourcePersistentIds(myIdHelperService); + List persistentIds = myData.getResourcePersistentIds(myIdHelperService); ourLog.info("Starting reindex work chunk with {} resources - Instance[{}] Chunk[{}]", persistentIds.size(), myInstanceId, myChunkId); StopWatch sw = new StopWatch(); @@ -120,7 +120,7 @@ public class ReindexStep implements IJobStepWorker dao = myDaoRegistry.getResourceDao(nextResourceType); - ResourcePersistentId resourcePersistentId = persistentIds.get(i); + BaseResourcePersistentId resourcePersistentId = persistentIds.get(i); try { dao.reindex(resourcePersistentId, myRequestDetails, myTransactionDetails); } catch (BaseServerResponseException | DataFormatException e) { diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java index c186c907dce..76fca8da9f2 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java @@ -4,9 +4,9 @@ package ca.uhn.fhir.batch2.jobs.export; import ca.uhn.fhir.batch2.api.IJobDataSink; import ca.uhn.fhir.batch2.api.RunOutcome; import ca.uhn.fhir.batch2.api.StepExecutionDetails; +import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; import ca.uhn.fhir.batch2.jobs.export.models.ExpandedResourcesList; import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; -import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; import ca.uhn.fhir.batch2.jobs.models.Id; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.context.FhirContext; @@ -15,7 +15,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.Patient; @@ -33,7 +33,6 @@ import java.util.Date; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -119,7 +118,7 @@ public class ExpandResourcesStepTest { instance ); ArrayList clone = new ArrayList<>(resources); - when(patientDao.readByPid(any(ResourcePersistentId.class))).thenAnswer(i -> clone.remove(0)); + when(patientDao.readByPid(any(BaseResourcePersistentId.class))).thenAnswer(i -> clone.remove(0)); // test RunOutcome outcome = mySecondStep.run(input, sink); diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java index dd4698e88f3..3b108c2a626 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java @@ -4,8 +4,8 @@ import ca.uhn.fhir.batch2.api.IJobDataSink; import ca.uhn.fhir.batch2.api.RunOutcome; import ca.uhn.fhir.batch2.api.StepExecutionDetails; import ca.uhn.fhir.batch2.api.VoidModel; -import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; +import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; import ca.uhn.fhir.batch2.jobs.models.Id; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.jpa.api.config.DaoConfig; @@ -13,7 +13,7 @@ import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; @@ -98,8 +98,8 @@ public class FetchResourceIdsStepTest { instance.setInstanceId("1"); StepExecutionDetails input = createInput(parameters, instance); ourLog.setLevel(Level.INFO); - List patientIds = new ArrayList<>(); - List observationIds = new ArrayList<>(); + List patientIds = new ArrayList<>(); + List observationIds = new ArrayList<>(); { JpaPid id1 = new JpaPid(123L); @@ -173,7 +173,7 @@ public class FetchResourceIdsStepTest { parameters.setResourceTypes(Collections.singletonList("Patient")); StepExecutionDetails input = createInput(parameters, instance); ourLog.setLevel(Level.INFO); - List patientIds = new ArrayList<>(); + List patientIds = new ArrayList<>(); // when int maxFileCapacity = 5; @@ -202,7 +202,7 @@ public class FetchResourceIdsStepTest { // verify all submitted ids are there boolean found = false; - for (ResourcePersistentId pid : patientIds) { + for (BaseResourcePersistentId pid : patientIds) { Id id = Id.getIdFromPID(pid, "Patient"); for (ResourceIdList idList : listIds) { found = idList.getIds().contains(id); diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/jobs/chunk/ResourceIdListWorkChunkJson.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/jobs/chunk/ResourceIdListWorkChunkJson.java index 3eaaa3cbd21..6f97de4d6e6 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/jobs/chunk/ResourceIdListWorkChunkJson.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/jobs/chunk/ResourceIdListWorkChunkJson.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.batch2.jobs.chunk; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.model.api.IModelJson; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -58,7 +58,7 @@ public class ResourceIdListWorkChunkJson implements IModelJson { .toString(); } - public List getResourcePersistentIds(IIdHelperService theIdHelperService) { + public List getResourcePersistentIds(IIdHelperService theIdHelperService) { if (myTypedPids.isEmpty()) { return Collections.emptyList(); } diff --git a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/jobs/step/LoadIdsStepTest.java b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/jobs/step/LoadIdsStepTest.java index 904f178e03a..b9449640092 100644 --- a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/jobs/step/LoadIdsStepTest.java +++ b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/jobs/step/LoadIdsStepTest.java @@ -11,7 +11,7 @@ import ca.uhn.fhir.jpa.api.pid.HomogeneousResourcePidList; import ca.uhn.fhir.jpa.api.pid.IResourcePidList; import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.r4.model.InstantType; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -104,7 +104,7 @@ public class LoadIdsStepTest { @Nonnull private IResourcePidList createIdChunk(long idLow, long idHigh, Date lastDate) { - List ids = new ArrayList<>(); + List ids = new ArrayList<>(); List resourceTypes = new ArrayList<>(); for (long i = idLow; i < idHigh; i++) { ids.add(new JpaPid(i)); diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/submit/MdmInflateAndSubmitResourcesStep.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/submit/MdmInflateAndSubmitResourcesStep.java index ca03456fa12..57278db1828 100644 --- a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/submit/MdmInflateAndSubmitResourcesStep.java +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/mdm/batch2/submit/MdmInflateAndSubmitResourcesStep.java @@ -32,7 +32,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.batch.log.Logs; import ca.uhn.fhir.mdm.api.IMdmChannelSubmitterSvc; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -54,7 +54,7 @@ public class MdmInflateAndSubmitResourcesStep implements IJobStepWorker myIdHelperService; + private IIdHelperService myIdHelperService; @Nonnull @Override @@ -82,9 +82,9 @@ public class MdmInflateAndSubmitResourcesStep implements IJobStepWorker fetchAllResources(List theIds) { + private List fetchAllResources(List theIds) { List resources = new ArrayList<>(); - for (ResourcePersistentId id : theIds) { + for (BaseResourcePersistentId id : theIds) { assert id.getResourceType() != null; IFhirResourceDao dao = myDaoRegistry.getResourceDao(id.getResourceType()); // This should be a query, but we have PIDs, and we don't have a _pid search param. TODO GGG, figure out how to make this search by pid. diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java index b7678ffb1ad..ecc5d0c2eba 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDao.java @@ -38,7 +38,7 @@ import ca.uhn.fhir.rest.api.PatchTypeEnum; import ca.uhn.fhir.rest.api.ValidationModeEnum; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.HistorySearchDateRangeParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -191,7 +191,7 @@ public interface IFhirResourceDao extends IDao { * @throws ResourceNotFoundException If the ID is not known to the server * @throws ResourceGoneException If the resource has been deleted */ - T readByPid(ResourcePersistentId thePid); + T readByPid(BaseResourcePersistentId thePid); /** * Read a resource by its internal PID @@ -199,7 +199,7 @@ public interface IFhirResourceDao extends IDao { * @throws ResourceGoneException If the resource has been deleted and theDeletedOk is true * */ - default T readByPid(ResourcePersistentId thePid, boolean theDeletedOk) { + default T readByPid(BaseResourcePersistentId thePid, boolean theDeletedOk) { throw new UnsupportedOperationException(Msg.code(571)); } @@ -248,7 +248,7 @@ public interface IFhirResourceDao extends IDao { /** * Search for IDs for processing a match URLs, etc. */ - default List searchForIds(SearchParameterMap theParams, RequestDetails theRequest) { + default List searchForIds(SearchParameterMap theParams, RequestDetails theRequest) { return searchForIds(theParams, theRequest, null); } @@ -259,7 +259,7 @@ public interface IFhirResourceDao extends IDao { * create/update, this is the resource being searched for * @since 5.5.0 */ - default List searchForIds(SearchParameterMap theParams, RequestDetails theRequest, @Nullable IBaseResource theConditionalOperationTargetOrNull) { + default List searchForIds(SearchParameterMap theParams, RequestDetails theRequest, @Nullable IBaseResource theConditionalOperationTargetOrNull) { return searchForIds(theParams, theRequest); } @@ -329,7 +329,7 @@ public interface IFhirResourceDao extends IDao { * @param theRequest the request that initiated the request * @return response back to the client */ -

DeleteMethodOutcome deletePidList(String theUrl, Collection

theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest); +

DeleteMethodOutcome deletePidList(String theUrl, Collection

theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest); /** * @deprecated use #read(IIdType, RequestDetails) instead @@ -343,5 +343,5 @@ public interface IFhirResourceDao extends IDao { * * @param theResourcePersistentId The ID */ - void reindex(ResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails); + void reindex(BaseResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirSystemDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirSystemDao.java index 621add0cd87..01506033686 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirSystemDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirSystemDao.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.springframework.transaction.annotation.Transactional; @@ -90,7 +90,7 @@ public interface IFhirSystemDao extends IDao { * Preload resources from the database in batch. This method is purely * a performance optimization and must be purely idempotent. */ - default

void preFetchResources(List

theResolvedIds) { + default

void preFetchResources(List

theResolvedIds) { // nothing by default } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DaoMethodOutcome.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DaoMethodOutcome.java index ae14d1bf7cd..546af07be80 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DaoMethodOutcome.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/DaoMethodOutcome.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.api.model; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; public class DaoMethodOutcome extends MethodOutcome { @@ -31,7 +31,7 @@ public class DaoMethodOutcome extends MethodOutcome { private IBasePersistedResource myEntity; private IBaseResource myPreviousResource; private boolean myNop; - private ResourcePersistentId myResourcePersistentId; + private BaseResourcePersistentId myResourcePersistentId; private RestOperationTypeEnum myOperationType; private String myMatchUrl; @@ -104,11 +104,11 @@ public class DaoMethodOutcome extends MethodOutcome { return this; } - public ResourcePersistentId getPersistentId() { + public BaseResourcePersistentId getPersistentId() { return myResourcePersistentId; } - public DaoMethodOutcome setPersistentId(ResourcePersistentId theResourcePersistentId) { + public DaoMethodOutcome setPersistentId(BaseResourcePersistentId theResourcePersistentId) { myResourcePersistentId = theResourcePersistentId; return this; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/LazyDaoMethodOutcome.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/LazyDaoMethodOutcome.java index 51e78814610..98a1d718f05 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/LazyDaoMethodOutcome.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/LazyDaoMethodOutcome.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.api.model; */ import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -36,7 +36,7 @@ public class LazyDaoMethodOutcome extends DaoMethodOutcome { /** * Constructor */ - public LazyDaoMethodOutcome(ResourcePersistentId theResourcePersistentId) { + public LazyDaoMethodOutcome(BaseResourcePersistentId theResourcePersistentId) { setPersistentId(theResourcePersistentId); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/PersistentIdToForcedIdMap.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/PersistentIdToForcedIdMap.java index b59f28ad9bd..61009e41c47 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/PersistentIdToForcedIdMap.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/model/PersistentIdToForcedIdMap.java @@ -20,14 +20,14 @@ package ca.uhn.fhir.jpa.api.model; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -public class PersistentIdToForcedIdMap

{ +public class PersistentIdToForcedIdMap

{ private final Map> myResourcePersistentIdOptionalMap; public PersistentIdToForcedIdMap(Map> theResourcePersistentIdOptionalMap){ diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/BaseResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/BaseResourcePidList.java index bccb3974948..21c8492ffaa 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/BaseResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/BaseResourcePidList.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.api.pid; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -32,12 +32,12 @@ import java.util.List; abstract public class BaseResourcePidList implements IResourcePidList { - final List myIds = new ArrayList<>(); + final List myIds = new ArrayList<>(); @Nullable final Date myLastDate; - BaseResourcePidList(Collection theIds, Date theLastDate) { + BaseResourcePidList(Collection theIds, Date theLastDate) { myIds.addAll(theIds); myLastDate = theLastDate; } @@ -68,11 +68,11 @@ abstract public class BaseResourcePidList implements IResourcePidList { } @Override - public List getIds() { + public List getIds() { return Collections.unmodifiableList(myIds); } - public ResourcePersistentId getId(int theIndex) { + public BaseResourcePersistentId getId(int theIndex) { return myIds.get(theIndex); } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/EmptyResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/EmptyResourcePidList.java index 6f62f603596..e42f41ff0d1 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/EmptyResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/EmptyResourcePidList.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.api.pid; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nonnull; import java.util.Collections; @@ -54,7 +54,7 @@ public class EmptyResourcePidList implements IResourcePidList { } @Override - public List getIds() { + public List getIds() { return Collections.emptyList(); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java index 24db9fc166b..89814c0abb0 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.api.pid; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nonnull; import java.util.Collection; @@ -33,7 +33,7 @@ public class HomogeneousResourcePidList extends BaseResourcePidList { @Nonnull final String myResourceType; - public HomogeneousResourcePidList(String theResourceType, Collection theIds, Date theLastDate) { + public HomogeneousResourcePidList(String theResourceType, Collection theIds, Date theLastDate) { super(theIds, theLastDate); myResourceType = theResourceType; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/IResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/IResourcePidList.java index 95d1dfbb829..8068397211e 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/IResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/IResourcePidList.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.api.pid; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nonnull; import java.util.Date; @@ -40,7 +40,7 @@ public interface IResourcePidList { String getResourceType(int i); - List getIds(); + List getIds(); boolean isEmpty(); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java index 696204126b1..4a05bda61b4 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.api.pid; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nonnull; import java.util.Collection; @@ -34,7 +34,7 @@ public class MixedResourcePidList extends BaseResourcePidList { @Nonnull final List myResourceTypes; - public MixedResourcePidList(List theResourceTypes, Collection theIds, Date theLastDate) { + public MixedResourcePidList(List theResourceTypes, Collection theIds, Date theLastDate) { super(theIds, theLastDate); myResourceTypes = theResourceTypes; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/ResourcePidListBuilder.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/ResourcePidListBuilder.java index a0022c465b1..ca2e494bacd 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/ResourcePidListBuilder.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/ResourcePidListBuilder.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.api.pid; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.ArrayList; import java.util.Date; @@ -37,7 +37,7 @@ public class ResourcePidListBuilder { return empty(); } - Set ids = new LinkedHashSet<>(); + Set ids = new LinkedHashSet<>(); Date endDate = null; Set resourceTypes = new HashSet<>(); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/TypedResourcePid.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/TypedResourcePid.java index 944ed1c5e84..17473006c81 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/TypedResourcePid.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/TypedResourcePid.java @@ -21,15 +21,15 @@ package ca.uhn.fhir.jpa.api.pid; */ import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.Objects; public class TypedResourcePid { public final String resourceType; - public final ResourcePersistentId id; + public final BaseResourcePersistentId id; - public TypedResourcePid(String theResourceType, ResourcePersistentId theId) { + public TypedResourcePid(String theResourceType, BaseResourcePersistentId theId) { this.resourceType = theResourceType; this.id = theId; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java index 5edcb0f309c..e017de16fa2 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.model.PersistentIdToForcedIdMap; import ca.uhn.fhir.jpa.model.cross.IResourceLookup; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -39,10 +39,10 @@ import java.util.Optional; import java.util.Set; /** - * This interface is used to translate between {@link ResourcePersistentId} + * This interface is used to translate between {@link BaseResourcePersistentId} * and actual resource IDs. */ -public interface IIdHelperService { +public interface IIdHelperService { /** * Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs. diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/ISearchCoordinatorSvc.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/ISearchCoordinatorSvc.java index abb88f36bf1..a45399578ab 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/ISearchCoordinatorSvc.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/ISearchCoordinatorSvc.java @@ -26,13 +26,13 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import javax.annotation.Nullable; import java.util.List; import java.util.Optional; -public interface ISearchCoordinatorSvc { +public interface ISearchCoordinatorSvc { void cancelAllActiveSearches(); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/api/IBulkExportProcessor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/api/IBulkExportProcessor.java index e6e61fb50c7..d41d4a57583 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/api/IBulkExportProcessor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/api/IBulkExportProcessor.java @@ -21,13 +21,13 @@ package ca.uhn.fhir.jpa.bulk.export.api; */ import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import java.util.Iterator; import java.util.List; -public interface IBulkExportProcessor { +public interface IBulkExportProcessor { /** * For fetching PIDs of resources diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java index 531105a446f..d93e8d36088 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java @@ -39,6 +39,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.util.JpaParamUtil; import ca.uhn.fhir.model.api.IQueryParameterAnd; +import ca.uhn.fhir.model.api.StorageResponseCodeEnum; import ca.uhn.fhir.rest.api.QualifiedParamList; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails; @@ -46,7 +47,7 @@ import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.SimplePreResourceAccessDetails; import ca.uhn.fhir.rest.api.server.SimplePreResourceShowDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.QualifierDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -61,7 +62,6 @@ import ca.uhn.fhir.util.BundleUtil; import ca.uhn.fhir.util.FhirTerser; import ca.uhn.fhir.util.OperationOutcomeUtil; import ca.uhn.fhir.util.ResourceReferenceInfo; -import ca.uhn.fhir.model.api.StorageResponseCodeEnum; import ca.uhn.fhir.util.StopWatch; import ca.uhn.fhir.util.UrlUtil; import com.google.common.annotations.VisibleForTesting; @@ -318,7 +318,7 @@ public abstract class BaseStorageDao { return outcome; } - protected DaoMethodOutcome toMethodOutcomeLazy(RequestDetails theRequest, ResourcePersistentId theResourcePersistentId, @Nonnull final Supplier theEntity, Supplier theIdSupplier) { + protected DaoMethodOutcome toMethodOutcomeLazy(RequestDetails theRequest, BaseResourcePersistentId theResourcePersistentId, @Nonnull final Supplier theEntity, Supplier theIdSupplier) { LazyDaoMethodOutcome outcome = new LazyDaoMethodOutcome(theResourcePersistentId); outcome.setEntitySupplier(theEntity); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java index ffd3ec75623..accc2e17b97 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java @@ -33,7 +33,7 @@ import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.PatchTypeEnum; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -76,12 +76,12 @@ public abstract class BaseStorageResourceDao extends Ba IIdType resourceId; if (isNotBlank(theConditionalUrl)) { - Set match = getMatchResourceUrlService().processMatchUrl(theConditionalUrl, getResourceType(), theTransactionDetails, theRequestDetails); + Set match = getMatchResourceUrlService().processMatchUrl(theConditionalUrl, getResourceType(), theTransactionDetails, theRequestDetails); if (match.size() > 1) { String msg = getContext().getLocalizer().getMessageSanitized(BaseStorageDao.class, "transactionOperationWithMultipleMatchFailure", "PATCH", theConditionalUrl, match.size()); throw new PreconditionFailedException(Msg.code(972) + msg); } else if (match.size() == 1) { - ResourcePersistentId pid = match.iterator().next(); + BaseResourcePersistentId pid = match.iterator().next(); entityToUpdate = readEntityLatestVersion(pid, theRequestDetails, theTransactionDetails); resourceId = entityToUpdate.getIdDt(); } else { @@ -140,7 +140,7 @@ public abstract class BaseStorageResourceDao extends Ba @Nonnull protected abstract String getResourceName(); - protected abstract IBasePersistedResource readEntityLatestVersion(ResourcePersistentId thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails); + protected abstract IBasePersistedResource readEntityLatestVersion(BaseResourcePersistentId thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails); protected abstract IBasePersistedResource readEntityLatestVersion(IIdType theId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/IResultIterator.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/IResultIterator.java index 269aac1412d..e770906ddad 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/IResultIterator.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/IResultIterator.java @@ -20,13 +20,13 @@ package ca.uhn.fhir.jpa.dao; * #L% */ -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.io.Closeable; import java.util.Collection; import java.util.Iterator; -public interface IResultIterator extends Iterator, Closeable { +public interface IResultIterator extends Iterator, Closeable { int getSkippedCount(); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/ISearchBuilder.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/ISearchBuilder.java index 94ffadcd12e..17b717c7488 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/ISearchBuilder.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/ISearchBuilder.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.DateRangeParam; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -36,7 +36,7 @@ import java.util.Collection; import java.util.List; import java.util.Set; -public interface ISearchBuilder { +public interface ISearchBuilder { String SEARCH_BUILDER_BEAN_NAME = "SearchBuilder"; IResultIterator createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntime, RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java index a3328cfd34d..cf0024b01a6 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java @@ -36,7 +36,7 @@ import ca.uhn.fhir.jpa.util.MemoryCacheService; import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.SimplePreResourceShowDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -60,7 +60,7 @@ import java.util.Set; import java.util.stream.Collectors; @Service -public class MatchResourceUrlService { +public class MatchResourceUrlService { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MatchResourceUrlService.class); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java index 21e2737c2f7..79125452da5 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java @@ -22,12 +22,12 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.IDao; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -public class SearchBuilderFactory> { +public class SearchBuilderFactory> { @Autowired private ApplicationContext myApplicationContext; diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java index 393dfa92ff8..79d0616b08b 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -48,12 +48,12 @@ public class ExpungeOperation implements Callable { private DaoConfig myDaoConfig; private final String myResourceName; - private final ResourcePersistentId myResourceId; + private final BaseResourcePersistentId myResourceId; private final ExpungeOptions myExpungeOptions; private final RequestDetails myRequestDetails; private final AtomicInteger myRemainingCount; - public ExpungeOperation(String theResourceName, ResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { + public ExpungeOperation(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { myResourceName = theResourceName; myResourceId = theResourceId; myExpungeOptions = theExpungeOptions; @@ -81,7 +81,7 @@ public class ExpungeOperation implements Callable { } private void expungeDeletedResources() { - List resourceIds = findHistoricalVersionsOfDeletedResources(); + List resourceIds = findHistoricalVersionsOfDeletedResources(); deleteHistoricalVersions(resourceIds); if (expungeLimitReached()) { @@ -91,13 +91,13 @@ public class ExpungeOperation implements Callable { deleteCurrentVersionsOfDeletedResources(resourceIds); } - private List findHistoricalVersionsOfDeletedResources() { - List retVal = myExpungeDaoService.findHistoricalVersionsOfDeletedResources(myResourceName, myResourceId, myRemainingCount.get()); + private List findHistoricalVersionsOfDeletedResources() { + List retVal = myExpungeDaoService.findHistoricalVersionsOfDeletedResources(myResourceName, myResourceId, myRemainingCount.get()); ourLog.debug("Found {} historical versions", retVal.size()); return retVal; } - private List findHistoricalVersionsOfNonDeletedResources() { + private List findHistoricalVersionsOfNonDeletedResources() { return myExpungeDaoService.findHistoricalVersionsOfNonDeletedResources(myResourceName, myResourceId, myRemainingCount.get()); } @@ -110,7 +110,7 @@ public class ExpungeOperation implements Callable { } private void expungeOldVersions() { - List historicalIds = findHistoricalVersionsOfNonDeletedResources(); + List historicalIds = findHistoricalVersionsOfNonDeletedResources(); getPartitionRunner().runInPartitionedThreads(historicalIds, partition -> myExpungeDaoService.expungeHistoricalVersions(myRequestDetails, partition, myRemainingCount)); } @@ -119,11 +119,11 @@ public class ExpungeOperation implements Callable { return new PartitionRunner(PROCESS_NAME, THREAD_PREFIX, myDaoConfig.getExpungeBatchSize(), myDaoConfig.getExpungeThreadCount()); } - private void deleteCurrentVersionsOfDeletedResources(List theResourceIds) { + private void deleteCurrentVersionsOfDeletedResources(List theResourceIds) { getPartitionRunner().runInPartitionedThreads(theResourceIds, partition -> myExpungeDaoService.expungeCurrentVersionOfResources(myRequestDetails, partition, myRemainingCount)); } - private void deleteHistoricalVersions(List theResourceIds) { + private void deleteHistoricalVersions(List theResourceIds) { getPartitionRunner().runInPartitionedThreads(theResourceIds, partition -> myExpungeDaoService.expungeHistoricalVersionsOfIds(myRequestDetails, partition, myRemainingCount)); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeService.java index a4d64d7bdcb..1f101d2b045 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeService.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,11 +43,11 @@ public class ExpungeService { @Autowired private ApplicationContext myApplicationContext; - protected ExpungeOperation getExpungeOperation(String theResourceName, ResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { + protected ExpungeOperation getExpungeOperation(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) { return myApplicationContext.getBean(ExpungeOperation.class, theResourceName, theResourceId, theExpungeOptions, theRequestDetails); } - public ExpungeOutcome expunge(String theResourceName, ResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequest) { + public ExpungeOutcome expunge(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequest) { ourLog.info("Expunge: ResourceName[{}] Id[{}] Version[{}] Options[{}]", theResourceName, theResourceId != null ? theResourceId.getId() : null, theResourceId != null ? theResourceId.getVersion() : null, theExpungeOptions); ExpungeOperation expungeOperation = getExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequest); @@ -65,7 +65,7 @@ public class ExpungeService { return expungeOperation.call(); } - public void deleteAllSearchParams(ResourcePersistentId theResourceId) { + public void deleteAllSearchParams(BaseResourcePersistentId theResourceId) { myExpungeDaoService.deleteAllSearchParams(theResourceId); } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IResourceExpungeService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IResourceExpungeService.java index 3eb84b70608..79870a88b06 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IResourceExpungeService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/IResourceExpungeService.java @@ -21,12 +21,12 @@ package ca.uhn.fhir.jpa.dao.expunge; */ import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -public interface IResourceExpungeService { +public interface IResourceExpungeService { List findHistoricalVersionsOfDeletedResources(String theResourceName, T theResourceId, int theI); List findHistoricalVersionsOfNonDeletedResources(String theResourceName, T theResourceId, int theI); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunner.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunner.java index 99430100c10..3069d1d9e3d 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunner.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunner.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.dao.expunge; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.StopWatch; import com.google.common.collect.Lists; @@ -58,7 +58,7 @@ public class PartitionRunner { myThreadCount = theThreadCount; } - public void runInPartitionedThreads(List theResourceIds, Consumer> partitionConsumer) { + public void runInPartitionedThreads(List theResourceIds, Consumer> partitionConsumer) { List> callableTasks = buildCallableTasks(theResourceIds, partitionConsumer); if (callableTasks.size() == 0) { @@ -93,7 +93,7 @@ public class PartitionRunner { } } - private List> buildCallableTasks(List theResourceIds, Consumer> partitionConsumer) { + private List> buildCallableTasks(List theResourceIds, Consumer> partitionConsumer) { List> retval = new ArrayList<>(); if (myBatchSize > theResourceIds.size()) { @@ -101,9 +101,9 @@ public class PartitionRunner { } else { ourLog.info("Creating batch job of {} entries", theResourceIds.size()); } - List> partitions = Lists.partition(theResourceIds, myBatchSize); + List> partitions = Lists.partition(theResourceIds, myBatchSize); - for (List nextPartition : partitions) { + for (List nextPartition : partitions) { if (nextPartition.size() > 0) { Callable callableTask = () -> { ourLog.info(myProcessName + " {} resources", nextPartition.size()); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java index ad9bec2ce21..942771aa2ff 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java @@ -38,7 +38,7 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.searchparam.extractor.IResourceLinkResolver; import ca.uhn.fhir.jpa.searchparam.extractor.PathAndRef; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -65,7 +65,7 @@ import java.util.Date; import java.util.List; import java.util.Optional; -public class DaoResourceLinkResolver implements IResourceLinkResolver { +public class DaoResourceLinkResolver implements IResourceLinkResolver { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DaoResourceLinkResolver.class); @Autowired private DaoConfig myDaoConfig; @@ -307,7 +307,7 @@ public class DaoResourceLinkResolver implements myDaoRegistry.getDaoOrThrowException(theType); } - private static class ResourceLookupPersistentIdWrapper

implements IResourceLookup { + private static class ResourceLookupPersistentIdWrapper

implements IResourceLookup { private final P myPersistentId; public ResourceLookupPersistentIdWrapper(P thePersistentId) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamValidatingInterceptor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamValidatingInterceptor.java index 74bd16c5657..63f074f0301 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamValidatingInterceptor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/searchparam/submit/interceptor/SearchParamValidatingInterceptor.java @@ -31,27 +31,20 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.registry.SearchParameterCanonicalizer; -import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.rest.param.TokenOrListParam; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -import org.apache.commons.lang3.Validate; -import org.hl7.fhir.instance.model.api.IBaseExtension; -import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import static org.apache.commons.collections4.CollectionUtils.isNotEmpty; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -97,7 +90,7 @@ public class SearchParamValidatingInterceptor { } private void validateStandardSpOnCreate(RequestDetails theRequestDetails, SearchParameterMap searchParameterMap) { - List persistedIdList = getDao().searchForIds(searchParameterMap, theRequestDetails); + List persistedIdList = getDao().searchForIds(searchParameterMap, theRequestDetails); if( isNotEmpty(persistedIdList) ) { throw new UnprocessableEntityException(Msg.code(2196) + "Can't process submitted SearchParameter as it is overlapping an existing one."); } @@ -125,7 +118,7 @@ public class SearchParamValidatingInterceptor { } private void validateStandardSpOnUpdate(RequestDetails theRequestDetails, RuntimeSearchParam runtimeSearchParam, SearchParameterMap searchParameterMap) { - List pidList = getDao().searchForIds(searchParameterMap, theRequestDetails); + List pidList = getDao().searchForIds(searchParameterMap, theRequestDetails); if(isNotEmpty(pidList)){ Set resolvedResourceIds = myIdHelperService.translatePidsToFhirResourceIds(new HashSet<>(pidList)); if(isNewSearchParam(runtimeSearchParam, resolvedResourceIds)) { diff --git a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/SearchParameterValidatingInterceptorTest.java b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/SearchParameterValidatingInterceptorTest.java index bb6ad83f5df..add87483153 100644 --- a/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/SearchParameterValidatingInterceptorTest.java +++ b/hapi-fhir-storage/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/SearchParameterValidatingInterceptorTest.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.searchparam.registry.SearchParameterCanonicalizer; import ca.uhn.fhir.jpa.searchparam.submit.interceptor.SearchParamValidatingInterceptor; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import org.hl7.fhir.r4.model.Enumerations; import org.hl7.fhir.r4.model.Patient; @@ -144,7 +144,7 @@ public class SearchParameterValidatingInterceptorTest { } private void setPersistedSearchParameterIds(List theSearchParams) { - List resourcePersistentIds = theSearchParams + List resourcePersistentIds = theSearchParams .stream() .map(SearchParameter::getId) .map(s -> new JpaPid(Long.parseLong(s)))