Final TODOs

This commit is contained in:
Ken Stevens 2022-12-04 19:14:35 -05:00
parent c962869987
commit f455642ff2
106 changed files with 407 additions and 426 deletions

View File

@ -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);
}

View File

@ -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<T extends IBaseResource> extends B
@Nonnull
@Override
public <P extends ResourcePersistentId> DeleteMethodOutcome deletePidList(String theUrl, Collection<P> theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest) {
public <P extends BaseResourcePersistentId> DeleteMethodOutcome deletePidList(String theUrl, Collection<P> theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest) {
StopWatch w = new StopWatch();
TransactionDetails transactionDetails = new TransactionDetails();
List<ResourceTable> deletedResources = new ArrayList<>();
@ -1133,13 +1133,13 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> 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<T extends IBaseResource> extends B
@SuppressWarnings("unchecked")
@Override
public void reindex(ResourcePersistentId theJpaPid, RequestDetails theRequest, TransactionDetails theTransactionDetails) {
public void reindex(BaseResourcePersistentId theJpaPid, RequestDetails theRequest, TransactionDetails theTransactionDetails) {
Optional<ResourceTable> 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<T extends IBaseResource> 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());
}

View File

@ -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<T extends IBaseBundle, MT> extends B
@Override
@Transactional(propagation = Propagation.MANDATORY)
public <P extends ResourcePersistentId> void preFetchResources(List<P> theResolvedIds) {
public <P extends BaseResourcePersistentId> void preFetchResources(List<P> theResolvedIds) {
List<Long> pids = theResolvedIds
.stream()
.map(t -> ((JpaPid) t).getId())

View File

@ -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<?, Long, SearchLoadingOptionsStep, ?, ?> 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<ResourcePersistentId> convertLongsToResourcePersistentIds(List<Long> theLongPids) {
private List<BaseResourcePersistentId> convertLongsToResourcePersistentIds(List<Long> theLongPids) {
return theLongPids.stream()
.map(JpaPid::new)
.collect(Collectors.toList());
}
@Override
public List<ResourcePersistentId> everything(String theResourceName, SearchParameterMap theParams, ResourcePersistentId theReferencingPid) {
public List<BaseResourcePersistentId> everything(String theResourceName, SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) {
validateHibernateSearchIsEnabled();
// todo mb what about max results here?
List<ResourcePersistentId> retVal = toList(doSearch(null, theParams, theReferencingPid, 10_000), 10_000);
List<BaseResourcePersistentId> 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<ResourcePersistentId> search(String theResourceName, SearchParameterMap theParams) {
public List<BaseResourcePersistentId> 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<ResourcePersistentId> toList(ISearchQueryExecutor theSearchResultStream, long theMaxSize) {
private List<BaseResourcePersistentId> 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<ResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults) {
public List<BaseResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults) {
ensureElastic();
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
List<Long> pidList = new LastNOperation(getSearchSession(), myFhirContext, myModelConfig, mySearchParamRegistry)

View File

@ -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.
*/
<T extends ResourcePersistentId> List<T> search(String theResourceName, SearchParameterMap theParams);
<T extends BaseResourcePersistentId> List<T> search(String theResourceName, SearchParameterMap theParams);
/**
@ -63,7 +63,7 @@ public interface IFulltextSearchSvc {
*/
IBaseResource tokenAutocompleteValueSetSearch(ValueSetAutocompleteOptions theOptions);
<T extends ResourcePersistentId> List<T> everything(String theResourceName, SearchParameterMap theParams, T theReferencingPid);
<T extends BaseResourcePersistentId> List<T> everything(String theResourceName, SearchParameterMap theParams, T theReferencingPid);
boolean isDisabled();
@ -81,7 +81,7 @@ public interface IFulltextSearchSvc {
*/
void reindex(ResourceTable theEntity);
List<ResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults);
List<BaseResourcePersistentId> lastN(SearchParameterMap theParams, Integer theMaximumResults);
/**
* Returns inlined resource stored along with index mappings for matched identifiers

View File

@ -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<T extends IBaseResource> extends BaseHapiF
@Override
public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem, RequestDetails theRequest) {
List<IIdType> valueSetIds;
List<ResourcePersistentId> ids = searchForIds(new SearchParameterMap(org.hl7.fhir.r4.model.CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest);
List<BaseResourcePersistentId> 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);
}

View File

@ -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.
*/

View File

@ -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;
* <p>
* 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.
* </p>
@ -626,7 +626,7 @@ public class IdHelperService implements IIdHelperService<JpaPid> {
retVal.put(nextResourcePid, Optional.empty());
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.PID_TO_FORCED_ID, nextResourcePid, Optional.empty());
}
Map<ResourcePersistentId, Optional<String>> convertRetVal = new HashMap<>();
Map<BaseResourcePersistentId, Optional<String>> convertRetVal = new HashMap<>();
retVal.forEach(
(k, v) -> {
convertRetVal.put(new JpaPid(k), v);

View File

@ -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<MdmLink> {
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<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(ResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum) {
public List<MdmPidTuple> 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<MdmLink> {
}
@Override
public List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
public List<MdmPidTuple> 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<MdmLink> {
}
@Override
public List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
public List<MdmPidTuple> 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<MdmLink> {
}
@Override
public List<ResourcePersistentId> findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable) {
public List<BaseResourcePersistentId> 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<MdmLink> {
}
@Override
public List<ResourcePersistentId> findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List<Integer> thePartitionIds, Pageable thePageable) {
public List<BaseResourcePersistentId> findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List<Integer> 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<MdmLink> {
}
@Override
public List<MdmLink> findAllById(List<ResourcePersistentId> thePids) {
public List<MdmLink> findAllById(List<BaseResourcePersistentId> thePids) {
List<Long> theLongPids = thePids.stream().map(thePid -> ((JpaPid) thePid).getId()).collect(Collectors.toList());
return myMdmLinkDao.findAllById(theLongPids);
}
@Override
public Optional<MdmLink> findById(ResourcePersistentId thePid) {
public Optional<MdmLink> findById(BaseResourcePersistentId thePid) {
return myMdmLinkDao.findById(((JpaPid) thePid).getId());
}
@ -227,12 +227,12 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
}
@Override
public Optional<? extends IMdmLink> findBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch) {
public Optional<? extends IMdmLink> findBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch) {
return myMdmLinkDao.findBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMatch);
}
@Override
public void deleteLinksWithAnyReferenceToPids(List<ResourcePersistentId> theResourcePersistentIds) {
public void deleteLinksWithAnyReferenceToPids(List<BaseResourcePersistentId> theResourcePersistentIds) {
List<Long> 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)

View File

@ -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<ResourcePersistentId> ids = dao.searchForIds(searchParamMap, request);
List<BaseResourcePersistentId> 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<ResourcePersistentId> ids = content
List<BaseResourcePersistentId> ids = content
.stream()
.map(t -> new JpaPid((Long) t[0]))
.collect(Collectors.toList());

View File

@ -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<IBaseResource> getObservationResources(Collection<? extends ResourcePersistentId> thePids) {
public List<IBaseResource> getObservationResources(Collection<? extends BaseResourcePersistentId> thePids) {
SearchRequest searchRequest = buildObservationResourceSearchRequest(thePids);
try {
SearchResponse observationDocumentResponse = executeSearchRequest(searchRequest);
@ -780,7 +780,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
}
}
private SearchRequest buildObservationResourceSearchRequest(Collection<? extends ResourcePersistentId> thePids) {
private SearchRequest buildObservationResourceSearchRequest(Collection<? extends BaseResourcePersistentId> thePids) {
SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
// Query

View File

@ -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<IBaseResource> getObservationResources(Collection<? extends ResourcePersistentId> thePids);
List<IBaseResource> getObservationResources(Collection<? extends BaseResourcePersistentId> thePids);
}

View File

@ -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());

View File

@ -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<TermValueSetConcept> findByValueSetResourcePidSystemAndCode(ResourcePersistentId theResourcePid, String theSystem, String theCode) {
private List<TermValueSetConcept> findByValueSetResourcePidSystemAndCode(BaseResourcePersistentId theResourcePid, String theSystem, String theCode) {
assert TransactionSynchronizationManager.isSynchronizationActive();
List<TermValueSetConcept> retVal = new ArrayList<>();

View File

@ -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);

View File

@ -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<ResourcePersistentId> myList;
private List<BaseResourcePersistentId> myList;
private int index;
public ListResultIterator(List<ResourcePersistentId> theList) {
public ListResultIterator(List<BaseResourcePersistentId> theList) {
myList = theList;
}
@ -85,7 +85,7 @@ public class JpaBulkExportProcessorTest {
}
@Override
public Collection<ResourcePersistentId> getNextResultBatch(long theBatchSize) {
public Collection<BaseResourcePersistentId> 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<IPrimitiveType> patientTypes = createPatientTypes();
List<ResourcePersistentId> pids = new ArrayList<>();
List<BaseResourcePersistentId> 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<ResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<ResourcePersistentId, Optional<String>> answer = new HashMap<>();
for (ResourcePersistentId l : uniqPids) {
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<BaseResourcePersistentId, Optional<String>> 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<ResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<ResourcePersistentId, Optional<String>> answer = new HashMap<>();
for (ResourcePersistentId l : uniqPids) {
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<BaseResourcePersistentId, Optional<String>> 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)
);

View File

@ -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<ResourcePersistentId> bp = myObservationDao.searchForIds(map, new ServletRequestDetails());
List<BaseResourcePersistentId> bp = myObservationDao.searchForIds(map, new ServletRequestDetails());
assertNotNull(bp);
assertEquals(600, bp.size());

View File

@ -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<? extends IMdmLink> 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<? extends IMdmLink> getLinkByGoldenResourcePidAndSourceResourcePid(ResourcePersistentId theGoldenResourcePid, ResourcePersistentId theSourceResourcePid) {
public Optional<? extends IMdmLink> 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<? extends IMdmLink> getMdmLinksBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) {
public List<? extends IMdmLink> 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<? extends IMdmLink> getMatchedLinkForSourcePid(ResourcePersistentId theSourcePid) {
public Optional<? extends IMdmLink> getMatchedLinkForSourcePid(BaseResourcePersistentId theSourcePid) {
return myMdmLinkDao.findBySourcePidAndMatchResult(theSourcePid, MdmMatchResultEnum.MATCH);
}
@ -182,7 +182,7 @@ public class MdmLinkDaoSvc {
@Nonnull
private Optional<? extends IMdmLink> 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<? extends IMdmLink> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ResourcePersistentId theGoldenResourcePid,
ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) {
public Optional<? extends IMdmLink> 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<? extends IMdmLink> 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<? extends IMdmLink> 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<? extends IMdmLink> 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<? extends IMdmLink> 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<ResourcePersistentId> theGoldenResourcePids) {
public void deleteLinksWithAnyReferenceToPids(List<BaseResourcePersistentId> theGoldenResourcePids) {
myMdmLinkDao.deleteLinksWithAnyReferenceToPids(theGoldenResourcePids);
}
}

View File

@ -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<? extends IMdmLink> fromLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theFromResource); // fromLinks - links going to theFromResource
List<? extends IMdmLink> toLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theToResource); // toLinks - links going to theToResource
List<IMdmLink> 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<? extends IMdmLink> optionalToLink = findFirstLinkWithMatchingSource(toLinks, fromLink);

View File

@ -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<ResourcePersistentId> ids = dao.searchForIds(searchParamMap, request);
List<BaseResourcePersistentId> ids = dao.searchForIds(searchParamMap, request);
Date lastDate = null;
if (ids.size() > 0) {

View File

@ -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 {

View File

@ -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);

View File

@ -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<ResourcePersistentId> theGoldenResourceIds) {
public void deleteLinksWithAnyReferenceTo(List<BaseResourcePersistentId> theGoldenResourceIds) {
myMdmLinkDaoSvc.deleteLinksWithAnyReferenceToPids(theGoldenResourceIds);
}

View File

@ -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<? extends IMdmLink> oMdmLink = myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourceId, targetId);
if (!oMdmLink.isPresent()) {

View File

@ -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));

View File

@ -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);
}

View File

@ -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);

View File

@ -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<MatchedGoldenResourceCandidate> findMatchGoldenResourceCandidates(IAnyResource theTarget) {
List<MatchedGoldenResourceCandidate> retval = new ArrayList<>();
List<ResourcePersistentId> goldenResourcePidsToExclude = getNoMatchGoldenResourcePids(theTarget);
List<BaseResourcePersistentId> goldenResourcePidsToExclude = getNoMatchGoldenResourcePids(theTarget);
List<MatchedTarget> 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<ResourcePersistentId> getNoMatchGoldenResourcePids(IBaseResource theBaseResource) {
ResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource);
private List<BaseResourcePersistentId> getNoMatchGoldenResourcePids(IBaseResource theBaseResource) {
BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource);
return myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(targetPid, MdmMatchResultEnum.NO_MATCH)
.stream()
.map(IMdmLink::getGoldenResourcePersistenceId)

View File

@ -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<MatchedGoldenResourceCandidate> findMatchGoldenResourceCandidates(IAnyResource theTarget) {
List<MatchedGoldenResourceCandidate> retval = new ArrayList<>();
ResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget);
BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget);
if (targetPid != null) {
Optional<? extends IMdmLink> 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()));
}

View File

@ -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;
}

View File

@ -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<IAnyResource> findCandidates(String theResourceType, IAnyResource theResource, RequestPartitionId theRequestPartitionId) {
Map<ResourcePersistentId, IAnyResource> matchedPidsToResources = new HashMap<>();
Map<BaseResourcePersistentId, IAnyResource> matchedPidsToResources = new HashMap<>();
List<MdmFilterSearchParamJson> filterSearchParams = myMdmSettings.getMdmRules().getCandidateFilterSearchParams();
List<String> filterCriteria = buildFilterQuery(filterSearchParams, theResourceType);
List<MdmResourceSearchParamJson> 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<ResourcePersistentId, IAnyResource> theMatchedPidsToResources, List<String> theFilterCriteria, MdmResourceSearchParamJson resourceSearchParam, RequestPartitionId theRequestPartitionId) {
private void searchForIdsAndAddToMap(String theResourceType, IAnyResource theResource, Map<BaseResourcePersistentId, IAnyResource> theMatchedPidsToResources, List<String> theFilterCriteria, MdmResourceSearchParamJson resourceSearchParam, RequestPartitionId theRequestPartitionId) {
//1.
Optional<String> oResourceCriteria = myMdmCandidateSearchCriteriaBuilderSvc.buildResourceQueryString(theResourceType, theResource, theFilterCriteria, resourceSearchParam);
if (!oResourceCriteria.isPresent()) {

View File

@ -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);
}
}

View File

@ -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<IAnyReso
}
@Nullable
protected ResourcePersistentId getMatchedResourcePidFromResource(IAnyResource theResource) {
ResourcePersistentId retval;
protected BaseResourcePersistentId getMatchedResourcePidFromResource(IAnyResource theResource) {
BaseResourcePersistentId retval;
boolean isGoldenRecord = MdmResourceUtil.isMdmManaged(theResource);
if (isGoldenRecord) {
@ -53,7 +53,7 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher<IAnyReso
return retval;
}
protected List<ResourcePersistentId> getPossibleMatchedGoldenResourcePidsFromTarget(IAnyResource theBaseResource) {
protected List<BaseResourcePersistentId> 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<IAnyReso
}
protected List<? extends IMdmLink> getMdmLinksForTarget(IAnyResource theTargetResource, MdmMatchResultEnum theMatchResult) {
ResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTargetResource);
BaseResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTargetResource);
List<? extends IMdmLink> matchLinkForTarget = myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(pidOrNull, theMatchResult);
if (!matchLinkForTarget.isEmpty()) {
return matchLinkForTarget;

View File

@ -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<ResourcePersistentId> baseResourceGoldenResourcePids;
private ResourcePersistentId incomingResourceGoldenResourcePid;
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
protected IsLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);

View File

@ -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<ResourcePersistentId> goldenResourcePidsToMatch = myBaseResources.stream()
List<BaseResourcePersistentId> goldenResourcePidsToMatch = myBaseResources.stream()
.map(this::getMatchedResourcePidFromResource)
.collect(Collectors.toList());

View File

@ -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<ResourcePersistentId> baseResourceGoldenResourcePids;
private ResourcePersistentId incomingResourceGoldenResourcePid;
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
protected IsPossibleLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theTargetResources) {
super(theIdHelperService, theMdmLinkDaoSvc, theTargetResources);

View File

@ -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<? extends IMdmLink> mdmLinks = getMdmLinksForTarget(theIncomingResource, MdmMatchResultEnum.POSSIBLE_MATCH);
List<ResourcePersistentId> goldenResourcePidsToMatch = myBaseResources.stream()
List<BaseResourcePersistentId> 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<ResourcePersistentId> mdmLinkGoldenResourcePids = mdmLinks
List<BaseResourcePersistentId> mdmLinkGoldenResourcePids = mdmLinks
.stream().map(IMdmLink::getGoldenResourcePersistenceId)
.collect(Collectors.toList());

View File

@ -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<ResourcePersistentId> goldenResourcePidsToMatch;
private ResourcePersistentId incomingGoldenResourcePid;
private List<BaseResourcePersistentId> goldenResourcePidsToMatch;
private BaseResourcePersistentId incomingGoldenResourcePid;
public IsSameGoldenResourceAs(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);

View File

@ -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);

View File

@ -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<ResourcePersistentId> duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2)
List<BaseResourcePersistentId> duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2)
.map(t -> myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), getGoldenResourceFromTargetResource(t)))
.collect(Collectors.toList()));

View File

@ -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<ResourcePersistentId> duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2)
List<BaseResourcePersistentId> duplicatePids = runInTransaction(()->Stream.of(finalPatient1, finalPatient2)
.map(t -> myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), getGoldenResourceFromTargetResource(t)))
.collect(Collectors.toList()));

View File

@ -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<T extends ResourcePersistentId> {
public interface IResourceLookup<T extends BaseResourcePersistentId> {
String getResourceType();
/**

View File

@ -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<Long> {
public class JpaPid extends BaseResourcePersistentId<Long> {
private final Long myId;
public JpaPid(Long theId) {

View File

@ -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());
}

View File

@ -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<IIdType, ResourcePersistentId> myMap = new HashMap<>();
private final Map<IIdType, BaseResourcePersistentId> myMap = new HashMap<>();
public static ResourcePersistentIdMap fromResourcePersistentIds(List<ResourcePersistentId> theResourcePersistentIds) {
public static ResourcePersistentIdMap fromResourcePersistentIds(List<BaseResourcePersistentId> 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);
}

View File

@ -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();

View File

@ -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<ResourcePersistentId> resourceIds = mySearchCoordinatorSvc.getResources(theJobDetails.getCurrentSearchUuid(), fromIndex, toIndex, null);
List<BaseResourcePersistentId> 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<Void> future = submitResource(theJobDetails.getSubscriptionId(), nextResource);
futures.add(Pair.of(nextResource.getIdElement().getIdPart(), future));

View File

@ -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<ResourcePersistentId> found;
List<BaseResourcePersistentId> 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();

View File

@ -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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new IdentifierDt(subStr1, subStr2)), null);
List<BaseResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new IdentifierDt(subStr1, subStr2)), null);
int initial = val.size();
myOrganizationDao.create(org, mySrd);

View File

@ -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<JpaPid> pids = (List<JpaPid>) theInvocation.getArguments()[0];
List<IBaseResource> resources = (List<IBaseResource>) theInvocation.getArguments()[2];
for (ResourcePersistentId nextPid : pids) {
for (BaseResourcePersistentId nextPid : pids) {
Patient pt = new Patient();
pt.setId(nextPid.toString());
resources.add(pt);

View File

@ -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<ResourcePersistentId> results = new ArrayList<>();
ArrayList<BaseResourcePersistentId> 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<JpaPid> myWrap;
private final List<ResourcePersistentId> myReturnedValues = new ArrayList<>();
private final List<BaseResourcePersistentId> myReturnedValues = new ArrayList<>();
private final AtomicInteger myCountReturned = new AtomicInteger(0);
SlowIterator(Iterator<JpaPid> theWrap, int theDelay) {
@ -680,7 +680,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{
myResultIteratorWrap = null;
}
List<ResourcePersistentId> getReturnedValues() {
List<BaseResourcePersistentId> getReturnedValues() {
return myReturnedValues;
}

View File

@ -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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null);
List<BaseResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null);
int initial = val.size();
myOrganizationDao.create(org, mySrd);

View File

@ -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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
List<BaseResourcePersistentId> 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<ResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null);
List<BaseResourcePersistentId> val = myOrganizationDao.searchForIds(new SearchParameterMap("type", new TokenParam(subStr1, subStr2)), null);
int initial = val.size();
myOrganizationDao.create(org, mySrd);

View File

@ -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<ResourcePersistentId> pids = myIdHelperService.resolveResourcePersistentIdsWithCache(null,
List<BaseResourcePersistentId> pids = myIdHelperService.resolveResourcePersistentIdsWithCache(null,
Collections.singletonList(savedPatientId));
Long savedPatientPid = ((JpaPid) pids.get(0)).getId();
assertEquals(savedPatientPid.longValue(), pid.get());

View File

@ -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;

View File

@ -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<ResourcePersistentId> resourceIds = buildPidList(0);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
List<BaseResourcePersistentId> resourceIds = buildPidList(0);
Consumer<List<BaseResourcePersistentId>> 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<ResourcePersistentId> buildPidList(int size) {
List<ResourcePersistentId> list = new ArrayList<>();
private List<BaseResourcePersistentId> buildPidList(int size) {
List<BaseResourcePersistentId> 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<ResourcePersistentId> resourceIds = buildPidList(1);
List<BaseResourcePersistentId> resourceIds = buildPidList(1);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
Consumer<List<BaseResourcePersistentId>> 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<ResourcePersistentId> resourceIds = buildPidList(2);
List<BaseResourcePersistentId> resourceIds = buildPidList(2);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
Consumer<List<BaseResourcePersistentId>> 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<ResourcePersistentId> resourceIds = buildPidList(10);
List<BaseResourcePersistentId> resourceIds = buildPidList(10);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
Consumer<List<BaseResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
myLatch.setExpectedCount(2);
getPartitionRunner(5).runInPartitionedThreads(resourceIds, partitionConsumer);
List<HookParams> calls = myLatch.awaitExpected();
@ -108,13 +108,13 @@ public class PartitionRunnerTest {
@Test
public void nineItemsBatch5() throws InterruptedException {
List<ResourcePersistentId> resourceIds = buildPidList(9);
List<BaseResourcePersistentId> resourceIds = buildPidList(9);
// We don't care in which order, but one partition size should be
// 5 and one should be 4
Set<Integer> nums = Sets.newHashSet(5, 4);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
Consumer<List<BaseResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
myLatch.setExpectedCount(2);
getPartitionRunner(5).runInPartitionedThreads(resourceIds, partitionConsumer);
List<HookParams> calls = myLatch.awaitExpected();
@ -129,9 +129,9 @@ public class PartitionRunnerTest {
@Test
public void tenItemsOneThread() throws InterruptedException {
List<ResourcePersistentId> resourceIds = buildPidList(10);
List<BaseResourcePersistentId> resourceIds = buildPidList(10);
Consumer<List<ResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
Consumer<List<BaseResourcePersistentId>> partitionConsumer = buildPartitionConsumer(myLatch);
myLatch.setExpectedCount(2);
getPartitionRunner(5, 1).runInPartitionedThreads(resourceIds, partitionConsumer);
List<HookParams> calls = myLatch.awaitExpected();
@ -147,7 +147,7 @@ public class PartitionRunnerTest {
}
}
private Consumer<List<ResourcePersistentId>> buildPartitionConsumer(PointcutLatch latch) {
private Consumer<List<BaseResourcePersistentId>> buildPartitionConsumer(PointcutLatch latch) {
return list -> latch.call(new PartitionCall(Thread.currentThread().getName(), list.size()));
}

View File

@ -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<ResourcePersistentId> resourcePersistentIds = new ArrayList<>();
List<BaseResourcePersistentId> resourcePersistentIds = new ArrayList<>();
List<Object[]> 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<IIdType, ResourcePersistentId> map = new HashMap<>();
HashMap<IIdType, BaseResourcePersistentId> 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;

View File

@ -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<T extends ResourcePersistentId> {
public interface IMdmLink<T extends BaseResourcePersistentId> {
T getId();
IMdmLink setId(T theId);

View File

@ -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<String> expandMdmBySourceResourceId(IIdType theId);
Set<String> expandMdmBySourceResourcePid(ResourcePersistentId theSourceResourcePid);
Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid);
Set<String> expandMdmByGoldenResourceId(ResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourcePid(ResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourceId(IdDt theId);
}

View File

@ -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<ResourcePersistentId> thePersistentIds);
void deleteLinksWithAnyReferenceTo(List<BaseResourcePersistentId> thePersistentIds);
}

View File

@ -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<T extends IMdmLink> {
int deleteWithAnyReferenceToPid(ResourcePersistentId thePid);
int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid);
int deleteWithAnyReferenceToPidAndMatchResultNot(ResourcePersistentId thePid, MdmMatchResultEnum theMatchResult);
int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult);
List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(ResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<ResourcePersistentId> findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable);
List<BaseResourcePersistentId> findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable);
List<ResourcePersistentId> findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold,List<Integer> thePartitionIds, Pageable thePageable);
List<BaseResourcePersistentId> findPidByResourceNameAndThresholdAndPartitionId(String theResourceName, Date theHighThreshold, List<Integer> thePartitionIds, Pageable thePageable);
List<T> findAllById(List<ResourcePersistentId> thePids);
List<T> findAllById(List<BaseResourcePersistentId> thePids);
Optional<T> findById(ResourcePersistentId thePid);
Optional<T> findById(BaseResourcePersistentId thePid);
void deleteAll(List<T> theLinks);
@ -76,7 +75,7 @@ public interface IMdmLinkDao<T extends IMdmLink> {
Page<T> search(IIdType theGoldenResourceId, IIdType theSourceId, MdmMatchResultEnum theMatchResult, MdmLinkSourceEnum theLinkSource, MdmPageRequest thePageRequest, List<Integer> thePartitionId);
Optional<? extends IMdmLink> findBySourcePidAndMatchResult(ResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch);
Optional<? extends IMdmLink> findBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch);
void deleteLinksWithAnyReferenceToPids(List<ResourcePersistentId> theResourcePersistentIds);
void deleteLinksWithAnyReferenceToPids(List<BaseResourcePersistentId> theResourcePersistentIds);
}

View File

@ -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<T extends ResourcePersistentId> {
public class MdmPidTuple<T extends BaseResourcePersistentId> {
private T myGoldenPid;
private T mySourcePid;

View File

@ -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());

View File

@ -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<String> expandMdmBySourceResourcePid(ResourcePersistentId theSourceResourcePid) {
public Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid) {
ourLog.debug("About to expand source resource with PID {}", theSourceResourcePid);
List<MdmPidTuple> 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<String> expandMdmByGoldenResourceId(ResourcePersistentId theGoldenResourcePid) {
public Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid) {
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
List<MdmPidTuple> 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<String> expandMdmByGoldenResourcePid(ResourcePersistentId theGoldenResourcePid) {
public Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid) {
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH);
return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples);
@ -127,13 +126,13 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc {
@Override
public Set<String> 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<String> flattenPidTuplesToSet(ResourcePersistentId initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
Set<ResourcePersistentId> flattenedPids = new HashSet<>();
public Set<String> flattenPidTuplesToSet(BaseResourcePersistentId initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
Set<BaseResourcePersistentId> flattenedPids = new HashSet<>();
goldenPidSourcePidTuples.forEach(tuple -> {
flattenedPids.add(tuple.getSourcePid());
flattenedPids.add(tuple.getGoldenPid());

View File

@ -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<ResourcePersistentId> pidBatch;
Collection<BaseResourcePersistentId> 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<ResourcePersistentId> thePidsToSubmit) {
private long loadPidsAndSubmitToMdmChannel(ISearchBuilder theSearchBuilder, Collection<BaseResourcePersistentId> thePidsToSubmit) {
List<IBaseResource> resourcesToSubmit = new ArrayList<>();
theSearchBuilder.loadResourcesByPid(thePidsToSubmit, Collections.emptyList(), resourcesToSubmit, false, null);
ourLog.info("Submitting {} resources to MDM", resourcesToSubmit.size());

View File

@ -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<T> {
public static final ResourcePersistentId NOT_FOUND = new NotFoundPid();
public abstract class BaseResourcePersistentId<T> {
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<T> {
/**
* @deprecated use subclass
*/
protected ResourcePersistentId(String theResourceType) {
protected BaseResourcePersistentId(String theResourceType) {
myResourceType = theResourceType;
}
@ -49,7 +49,7 @@ public abstract class ResourcePersistentId<T> {
* @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<T> {
return myAssociatedResourceId;
}
public ResourcePersistentId<T> setAssociatedResourceId(IIdType theAssociatedResourceId) {
public BaseResourcePersistentId<T> setAssociatedResourceId(IIdType theAssociatedResourceId) {
myAssociatedResourceId = theAssociatedResourceId;
return this;
}
@ -67,7 +67,7 @@ public abstract class ResourcePersistentId<T> {
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);
}

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.api.server.storage;
public class NotFoundPid extends ResourcePersistentId<Long> {
public class NotFoundPid extends BaseResourcePersistentId<Long> {
public NotFoundPid() {
super(null);
}

View File

@ -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<Runnable> myRollbackUndoActions = Collections.emptyList();
private Map<String, ResourcePersistentId> myResolvedResourceIds = Collections.emptyMap();
private Map<String, ResourcePersistentId> myResolvedMatchUrls = Collections.emptyMap();
private Map<String, BaseResourcePersistentId> myResolvedResourceIds = Collections.emptyMap();
private Map<String, BaseResourcePersistentId> myResolvedMatchUrls = Collections.emptyMap();
private Map<String, Object> myUserData;
private ListMultimap<Pointcut, HookParams> myDeferredInterceptorBroadcasts;
private EnumSet<Pointcut> 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 {
* "<code>Observation/123</code>") 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<String, ResourcePersistentId> getResolvedMatchUrls() {
public Map<String, BaseResourcePersistentId> getResolvedMatchUrls() {
return myResolvedMatchUrls;
}
@ -159,7 +159,7 @@ public class TransactionDetails {
* "<code>Observation/123</code>") 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();
}

View File

@ -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;

View File

@ -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<BulkExportJobPa
// filters are the filters for searching
ourLog.info("Running FetchResourceIdsStep for resource type: {} with params: {}", resourceType, providerParams);
Iterator<ResourcePersistentId> pidIterator = myBulkExportProcessor.getResourcePidIterator(providerParams);
Iterator<BaseResourcePersistentId> pidIterator = myBulkExportProcessor.getResourcePidIterator(providerParams);
List<Id> 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) {

View File

@ -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<BulkImportJobParamet
}
List<IIdType> idsList = new ArrayList<>(ids.keySet());
List<ResourcePersistentId> resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true);
for (ResourcePersistentId next : resolvedIds) {
List<BaseResourcePersistentId> resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true);
for (BaseResourcePersistentId next : resolvedIds) {
IIdType resId = next.getAssociatedResourceId();
theTransactionDetails.addResolvedResourceId(resId, next);
ids.remove(resId);

View File

@ -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);

View File

@ -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<ReindexJobParameters, Resourc
@Autowired
private DaoRegistry myDaoRegistry;
@Autowired
private IIdHelperService<ResourcePersistentId> myIdHelperService;
private IIdHelperService<BaseResourcePersistentId> myIdHelperService;
@Nonnull
@Override
@ -103,7 +103,7 @@ public class ReindexStep implements IJobStepWorker<ReindexJobParameters, Resourc
@Override
public Void doInTransaction(@Nonnull TransactionStatus theStatus) {
List<ResourcePersistentId> persistentIds = myData.getResourcePersistentIds(myIdHelperService);
List<BaseResourcePersistentId> 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<ReindexJobParameters, Resourc
String nextResourceType = myData.getResourceType(i);
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(nextResourceType);
ResourcePersistentId<?> resourcePersistentId = persistentIds.get(i);
BaseResourcePersistentId<?> resourcePersistentId = persistentIds.get(i);
try {
dao.reindex(resourcePersistentId, myRequestDetails, myTransactionDetails);
} catch (BaseServerResponseException | DataFormatException e) {

View File

@ -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<IBaseResource> 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);

View File

@ -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<BulkExportJobParameters, VoidModel> input = createInput(parameters, instance);
ourLog.setLevel(Level.INFO);
List<ResourcePersistentId> patientIds = new ArrayList<>();
List<ResourcePersistentId> observationIds = new ArrayList<>();
List<BaseResourcePersistentId> patientIds = new ArrayList<>();
List<BaseResourcePersistentId> observationIds = new ArrayList<>();
{
JpaPid id1 = new JpaPid(123L);
@ -173,7 +173,7 @@ public class FetchResourceIdsStepTest {
parameters.setResourceTypes(Collections.singletonList("Patient"));
StepExecutionDetails<BulkExportJobParameters, VoidModel> input = createInput(parameters, instance);
ourLog.setLevel(Level.INFO);
List<ResourcePersistentId> patientIds = new ArrayList<>();
List<BaseResourcePersistentId> 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);

View File

@ -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 <T extends ResourcePersistentId> List<T> getResourcePersistentIds(IIdHelperService<T> theIdHelperService) {
public <T extends BaseResourcePersistentId> List<T> getResourcePersistentIds(IIdHelperService<T> theIdHelperService) {
if (myTypedPids.isEmpty()) {
return Collections.emptyList();
}

View File

@ -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<ResourcePersistentId> ids = new ArrayList<>();
List<BaseResourcePersistentId> ids = new ArrayList<>();
List<String> resourceTypes = new ArrayList<>();
for (long i = idLow; i < idHigh; i++) {
ids.add(new JpaPid(i));

View File

@ -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<MdmSubmi
private ResponseTerminologyTranslationSvc myResponseTerminologyTranslationSvc;
@Autowired
private IMdmChannelSubmitterSvc myMdmChannelSubmitterSvc;
private IIdHelperService<? extends ResourcePersistentId> myIdHelperService;
private IIdHelperService<? extends BaseResourcePersistentId> myIdHelperService;
@Nonnull
@Override
@ -82,9 +82,9 @@ public class MdmInflateAndSubmitResourcesStep implements IJobStepWorker<MdmSubmi
return new RunOutcome(allResources.size());
}
private List<IBaseResource> fetchAllResources(List<? extends ResourcePersistentId> theIds) {
private List<IBaseResource> fetchAllResources(List<? extends BaseResourcePersistentId> theIds) {
List<IBaseResource> 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.

View File

@ -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<T extends IBaseResource> 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<T extends IBaseResource> 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<T extends IBaseResource> extends IDao {
/**
* Search for IDs for processing a match URLs, etc.
*/
default <T extends ResourcePersistentId> List<T> searchForIds(SearchParameterMap theParams, RequestDetails theRequest) {
default <T extends BaseResourcePersistentId> List<T> searchForIds(SearchParameterMap theParams, RequestDetails theRequest) {
return searchForIds(theParams, theRequest, null);
}
@ -259,7 +259,7 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
* create/update, this is the resource being searched for
* @since 5.5.0
*/
default <T extends ResourcePersistentId> List<T> searchForIds(SearchParameterMap theParams, RequestDetails theRequest, @Nullable IBaseResource theConditionalOperationTargetOrNull) {
default <T extends BaseResourcePersistentId> List<T> searchForIds(SearchParameterMap theParams, RequestDetails theRequest, @Nullable IBaseResource theConditionalOperationTargetOrNull) {
return searchForIds(theParams, theRequest);
}
@ -329,7 +329,7 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
* @param theRequest the request that initiated the request
* @return response back to the client
*/
<P extends ResourcePersistentId> DeleteMethodOutcome deletePidList(String theUrl, Collection<P> theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest);
<P extends BaseResourcePersistentId> DeleteMethodOutcome deletePidList(String theUrl, Collection<P> theResourceIds, DeleteConflictList theDeleteConflicts, RequestDetails theRequest);
/**
* @deprecated use #read(IIdType, RequestDetails) instead
@ -343,5 +343,5 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
*
* @param theResourcePersistentId The ID
*/
void reindex(ResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
void reindex(BaseResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
}

View File

@ -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<T, MT> extends IDao {
* Preload resources from the database in batch. This method is purely
* a performance optimization and must be purely idempotent.
*/
default <P extends ResourcePersistentId> void preFetchResources(List<P> theResolvedIds) {
default <P extends BaseResourcePersistentId> void preFetchResources(List<P> theResolvedIds) {
// nothing by default
}
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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<P extends ResourcePersistentId> {
public class PersistentIdToForcedIdMap<P extends BaseResourcePersistentId> {
private final Map<P, Optional<String>> myResourcePersistentIdOptionalMap;
public PersistentIdToForcedIdMap(Map<P, Optional<String>> theResourcePersistentIdOptionalMap){

View File

@ -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<ResourcePersistentId> myIds = new ArrayList<>();
final List<BaseResourcePersistentId> myIds = new ArrayList<>();
@Nullable
final Date myLastDate;
BaseResourcePidList(Collection<ResourcePersistentId> theIds, Date theLastDate) {
BaseResourcePidList(Collection<BaseResourcePersistentId> theIds, Date theLastDate) {
myIds.addAll(theIds);
myLastDate = theLastDate;
}
@ -68,11 +68,11 @@ abstract public class BaseResourcePidList implements IResourcePidList {
}
@Override
public List<ResourcePersistentId> getIds() {
public List<BaseResourcePersistentId> getIds() {
return Collections.unmodifiableList(myIds);
}
public ResourcePersistentId getId(int theIndex) {
public BaseResourcePersistentId getId(int theIndex) {
return myIds.get(theIndex);
}
}

View File

@ -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<ResourcePersistentId> getIds() {
public List<BaseResourcePersistentId> getIds() {
return Collections.emptyList();
}

View File

@ -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<ResourcePersistentId> theIds, Date theLastDate) {
public HomogeneousResourcePidList(String theResourceType, Collection<BaseResourcePersistentId> theIds, Date theLastDate) {
super(theIds, theLastDate);
myResourceType = theResourceType;
}

View File

@ -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<ResourcePersistentId> getIds();
List<BaseResourcePersistentId> getIds();
boolean isEmpty();
}

View File

@ -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<String> myResourceTypes;
public MixedResourcePidList(List<String> theResourceTypes, Collection<ResourcePersistentId> theIds, Date theLastDate) {
public MixedResourcePidList(List<String> theResourceTypes, Collection<BaseResourcePersistentId> theIds, Date theLastDate) {
super(theIds, theLastDate);
myResourceTypes = theResourceTypes;
}

View File

@ -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<ResourcePersistentId> ids = new LinkedHashSet<>();
Set<BaseResourcePersistentId> ids = new LinkedHashSet<>();
Date endDate = null;
Set<String> resourceTypes = new HashSet<>();

View File

@ -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;
}

View File

@ -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<T extends ResourcePersistentId> {
public interface IIdHelperService<T extends BaseResourcePersistentId> {
/**
* Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs.

View File

@ -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<T extends ResourcePersistentId> {
public interface ISearchCoordinatorSvc<T extends BaseResourcePersistentId> {
void cancelAllActiveSearches();

View File

@ -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<T extends ResourcePersistentId> {
public interface IBulkExportProcessor<T extends BaseResourcePersistentId> {
/**
* For fetching PIDs of resources

View File

@ -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<LazyDaoMethodOutcome.EntityAndResource> theEntity, Supplier<IIdType> theIdSupplier) {
protected DaoMethodOutcome toMethodOutcomeLazy(RequestDetails theRequest, BaseResourcePersistentId theResourcePersistentId, @Nonnull final Supplier<LazyDaoMethodOutcome.EntityAndResource> theEntity, Supplier<IIdType> theIdSupplier) {
LazyDaoMethodOutcome outcome = new LazyDaoMethodOutcome(theResourcePersistentId);
outcome.setEntitySupplier(theEntity);

View File

@ -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<T extends IBaseResource> extends Ba
IIdType resourceId;
if (isNotBlank(theConditionalUrl)) {
Set<ResourcePersistentId> match = getMatchResourceUrlService().processMatchUrl(theConditionalUrl, getResourceType(), theTransactionDetails, theRequestDetails);
Set<BaseResourcePersistentId> 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<T extends IBaseResource> 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);

View File

@ -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<T extends ResourcePersistentId> extends Iterator<T>, Closeable {
public interface IResultIterator<T extends BaseResourcePersistentId> extends Iterator<T>, Closeable {
int getSkippedCount();

View File

@ -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<T extends ResourcePersistentId> {
public interface ISearchBuilder<T extends BaseResourcePersistentId> {
String SEARCH_BUILDER_BEAN_NAME = "SearchBuilder";
IResultIterator createQuery(SearchParameterMap theParams, SearchRuntimeDetails theSearchRuntime, RequestDetails theRequest, @Nonnull RequestPartitionId theRequestPartitionId);

View File

@ -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<T extends ResourcePersistentId> {
public class MatchResourceUrlService<T extends BaseResourcePersistentId> {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MatchResourceUrlService.class);

View File

@ -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<T extends ResourcePersistentId<?>> {
public class SearchBuilderFactory<T extends BaseResourcePersistentId<?>> {
@Autowired
private ApplicationContext myApplicationContext;

View File

@ -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<ExpungeOutcome> {
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<ExpungeOutcome> {
}
private void expungeDeletedResources() {
List<ResourcePersistentId> resourceIds = findHistoricalVersionsOfDeletedResources();
List<BaseResourcePersistentId> resourceIds = findHistoricalVersionsOfDeletedResources();
deleteHistoricalVersions(resourceIds);
if (expungeLimitReached()) {
@ -91,13 +91,13 @@ public class ExpungeOperation implements Callable<ExpungeOutcome> {
deleteCurrentVersionsOfDeletedResources(resourceIds);
}
private List<ResourcePersistentId> findHistoricalVersionsOfDeletedResources() {
List<ResourcePersistentId> retVal = myExpungeDaoService.findHistoricalVersionsOfDeletedResources(myResourceName, myResourceId, myRemainingCount.get());
private List<BaseResourcePersistentId> findHistoricalVersionsOfDeletedResources() {
List<BaseResourcePersistentId> retVal = myExpungeDaoService.findHistoricalVersionsOfDeletedResources(myResourceName, myResourceId, myRemainingCount.get());
ourLog.debug("Found {} historical versions", retVal.size());
return retVal;
}
private List<ResourcePersistentId> findHistoricalVersionsOfNonDeletedResources() {
private List<BaseResourcePersistentId> findHistoricalVersionsOfNonDeletedResources() {
return myExpungeDaoService.findHistoricalVersionsOfNonDeletedResources(myResourceName, myResourceId, myRemainingCount.get());
}
@ -110,7 +110,7 @@ public class ExpungeOperation implements Callable<ExpungeOutcome> {
}
private void expungeOldVersions() {
List<ResourcePersistentId> historicalIds = findHistoricalVersionsOfNonDeletedResources();
List<BaseResourcePersistentId> historicalIds = findHistoricalVersionsOfNonDeletedResources();
getPartitionRunner().runInPartitionedThreads(historicalIds, partition -> myExpungeDaoService.expungeHistoricalVersions(myRequestDetails, partition, myRemainingCount));
}
@ -119,11 +119,11 @@ public class ExpungeOperation implements Callable<ExpungeOutcome> {
return new PartitionRunner(PROCESS_NAME, THREAD_PREFIX, myDaoConfig.getExpungeBatchSize(), myDaoConfig.getExpungeThreadCount());
}
private void deleteCurrentVersionsOfDeletedResources(List<ResourcePersistentId> theResourceIds) {
private void deleteCurrentVersionsOfDeletedResources(List<BaseResourcePersistentId> theResourceIds) {
getPartitionRunner().runInPartitionedThreads(theResourceIds, partition -> myExpungeDaoService.expungeCurrentVersionOfResources(myRequestDetails, partition, myRemainingCount));
}
private void deleteHistoricalVersions(List<ResourcePersistentId> theResourceIds) {
private void deleteHistoricalVersions(List<BaseResourcePersistentId> theResourceIds) {
getPartitionRunner().runInPartitionedThreads(theResourceIds, partition -> myExpungeDaoService.expungeHistoricalVersionsOfIds(myRequestDetails, partition, myRemainingCount));
}

Some files were not shown because too many files have changed in this diff Show More