add <?> to Base so we can extract interface

This commit is contained in:
Ken Stevens 2022-12-05 11:29:51 -05:00
parent fd1be0049a
commit a806f3d2bc
60 changed files with 141 additions and 141 deletions

View File

@ -680,7 +680,7 @@ public class JpaConfig {
@Bean
@Scope("prototype")
public ExpungeOperation expungeOperation(String theResourceName, BaseResourcePersistentId 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

@ -1133,13 +1133,13 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
@Override
@Transactional
public T readByPid(BaseResourcePersistentId thePid) {
public T readByPid(BaseResourcePersistentId<?> thePid) {
return readByPid(thePid, false);
}
@Override
@Transactional
public T readByPid(BaseResourcePersistentId 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(BaseResourcePersistentId 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(BaseResourcePersistentId 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

@ -157,7 +157,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
// keep this in sync with supportsSomeOf();
private ISearchQueryExecutor doSearch(String theResourceType, SearchParameterMap theParams,
BaseResourcePersistentId 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, BaseResourcePersistentId 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, BaseResourcePersistentId theReferencingPid) {
SearchParameterMap theParams, BaseResourcePersistentId<?> theReferencingPid) {
return f.bool(b -> {
ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f);

View File

@ -90,7 +90,7 @@ public class JpaResourceDaoCodeSystem<T extends IBaseResource> extends BaseHapiF
List<IIdType> valueSetIds;
List<BaseResourcePersistentId> ids = searchForIds(new SearchParameterMap(org.hl7.fhir.r4.model.CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest);
valueSetIds = new ArrayList<>();
for (BaseResourcePersistentId next : ids) {
for (BaseResourcePersistentId<?> next : ids) {
IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next);
valueSetIds.add(id);
}

View File

@ -45,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 BaseResourcePersistentId} 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

@ -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 BaseResourcePersistentId} 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<BaseResourcePersistentId, Optional<String>> convertRetVal = new HashMap<>();
Map<BaseResourcePersistentId<?>, Optional<String>> convertRetVal = new HashMap<>();
retVal.forEach(
(k, v) -> {
convertRetVal.put(new JpaPid(k), v);

View File

@ -66,17 +66,17 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
private IIdHelperService myIdHelperService;
@Override
public int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid) {
public int deleteWithAnyReferenceToPid(BaseResourcePersistentId<?> thePid) {
return myMdmLinkDao.deleteWithAnyReferenceToPid(((JpaPid) thePid).getId());
}
@Override
public int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult) {
public int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId<?> thePid, MdmMatchResultEnum theMatchResult) {
return myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(((JpaPid) thePid).getId(), theMatchResult);
}
@Override
public List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId 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(BaseResourcePersistentId 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(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
public List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
return myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum)
.stream()
.map( theMdmPidTuple -> new MdmPidTuple()
@ -128,7 +128,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
}
@Override
public Optional<MdmLink> findById(BaseResourcePersistentId thePid) {
public Optional<MdmLink> findById(BaseResourcePersistentId<?> thePid) {
return myMdmLinkDao.findById(((JpaPid) thePid).getId());
}
@ -227,7 +227,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
}
@Override
public Optional<? extends IMdmLink> findBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch) {
public Optional<? extends IMdmLink> findBySourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMatch) {
return myMdmLinkDao.findBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMatch);
}

View File

@ -340,7 +340,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
@Override
@Transactional
public void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri,
public void storeNewCodeSystemVersion(BaseResourcePersistentId<?> theCodeSystemResourcePid, String theSystemUri,
String theSystemName, String theCodeSystemVersionId, TermCodeSystemVersion theCodeSystemVersion,
ResourceTable theCodeSystemResourceTable, RequestDetails theRequestDetails) {
assert TransactionSynchronizationManager.isActualTransactionActive();
@ -630,7 +630,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
}
@Nonnull
private TermCodeSystem getOrCreateDistinctTermCodeSystem(BaseResourcePersistentId 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

@ -1695,7 +1695,7 @@ public class TermReadSvcImpl implements ITermReadSvc {
.setMessage("Unable to validate code " + theSystem + "#" + theCode + theAppend);
}
private List<TermValueSetConcept> findByValueSetResourcePidSystemAndCode(BaseResourcePersistentId 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

@ -50,7 +50,7 @@ public interface ITermCodeSystemStorageSvc {
(boolean) theRequestDetails.getUserData().getOrDefault(MAKE_LOADING_VERSION_CURRENT, Boolean.TRUE);
}
void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName,
void storeNewCodeSystemVersion(BaseResourcePersistentId<?> theCodeSystemResourcePid, String theSystemUri, String theSystemName,
String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable,
RequestDetails theRequestDetails);
@ -58,7 +58,7 @@ public interface ITermCodeSystemStorageSvc {
* Default implementation supports previous signature of method which was added RequestDetails parameter
*/
@Transactional
default void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri, String theSystemName,
default void storeNewCodeSystemVersion(BaseResourcePersistentId<?> theCodeSystemResourcePid, String theSystemUri, String theSystemName,
String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable) {
storeNewCodeSystemVersion(theCodeSystemResourcePid, theSystemUri, theSystemName, theSystemVersionId,

View File

@ -100,7 +100,7 @@ public class JpaBulkExportProcessorTest {
}
@Override
public BaseResourcePersistentId 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 BaseResourcePersistentId getGoldenPid() {
public BaseResourcePersistentId<?> getGoldenPid() {
return new JpaPid(theGoldenId);
}
@Override
public BaseResourcePersistentId getSourcePid() {
public BaseResourcePersistentId<?> getSourcePid() {
return new JpaPid(theGroupId);
}
};
@ -292,8 +292,8 @@ public class JpaBulkExportProcessorTest {
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
.thenAnswer(params -> {
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<BaseResourcePersistentId, Optional<String>> answer = new HashMap<>();
for (BaseResourcePersistentId l : uniqPids) {
HashMap<BaseResourcePersistentId<?>, Optional<String>> answer = new HashMap<>();
for (BaseResourcePersistentId<?> l : uniqPids) {
answer.put(l, Optional.empty());
}
return new PersistentIdToForcedIdMap(answer);
@ -386,8 +386,8 @@ public class JpaBulkExportProcessorTest {
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
.thenAnswer(params -> {
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
HashMap<BaseResourcePersistentId, Optional<String>> answer = new HashMap<>();
for (BaseResourcePersistentId l : uniqPids) {
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()) {
BaseResourcePersistentId ret = iterator.next();
BaseResourcePersistentId<?> ret = iterator.next();
assertTrue(
ret.equals(pid) || ret.equals(pid2)
);

View File

@ -95,8 +95,8 @@ public class MdmLinkDaoSvc {
@Nonnull
public IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
BaseResourcePersistentId goldenResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
BaseResourcePersistentId 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(BaseResourcePersistentId theGoldenResourcePid, BaseResourcePersistentId 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(BaseResourcePersistentId 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(BaseResourcePersistentId 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) {
BaseResourcePersistentId 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(BaseResourcePersistentId theGoldenResourcePid,
BaseResourcePersistentId 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 BaseResourcePersistentId 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) {
BaseResourcePersistentId 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) {
BaseResourcePersistentId 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) {
BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
BaseResourcePersistentId<?> pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
if (pid == null) {
return Collections.emptyList();
}

View File

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

@ -167,7 +167,7 @@ public class MdmEidUpdateService {
if (theExistingMatchOrPossibleMatchLink.isPresent()) {
IMdmLink mdmLink = theExistingMatchOrPossibleMatchLink.get();
BaseResourcePersistentId existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId();
BaseResourcePersistentId<?> existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId();
myExistingGoldenResource = myMdmResourceDaoSvc.readGoldenResourceByPid(existingGoldenResourcePid, resourceType);
myRemainsMatchedToSameGoldenResource = candidateIsSameAsMdmLinkGoldenResource(mdmLink, theMatchedGoldenResourceCandidate);
} else {

View File

@ -71,8 +71,8 @@ public class MdmLinkCreateSvcImpl implements IMdmLinkCreateSvc {
validateCreateLinkRequest(theGoldenResource, theSourceResource, sourceType);
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
BaseResourcePersistentId 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

@ -78,8 +78,8 @@ public class MdmLinkSvcImpl implements IMdmLinkSvc {
}
private boolean goldenResourceLinkedAsNoMatch(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
BaseResourcePersistentId 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();

View File

@ -82,8 +82,8 @@ public class MdmLinkUpdaterSvcImpl implements IMdmLinkUpdaterSvc {
validateUpdateLinkRequest(theGoldenResource, theSourceResource, theMatchResult, sourceType);
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
BaseResourcePersistentId 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);
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
BaseResourcePersistentId 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

@ -93,7 +93,7 @@ public class MdmMatchLinkSvc {
private void handleMdmWithMultipleCandidates(IAnyResource theResource, CandidateList theCandidateList, MdmTransactionContext theMdmTransactionContext) {
MatchedGoldenResourceCandidate firstMatch = theCandidateList.getFirstMatch();
BaseResourcePersistentId sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid();
BaseResourcePersistentId<?> sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid();
boolean allSameGoldenResource = theCandidateList.stream()
.allMatch(candidate -> candidate.getCandidateGoldenResourcePid().equals(sampleGoldenResourcePid));

View File

@ -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(BaseResourcePersistentId theGoldenResourcePid, String theResourceType) {
public IAnyResource readGoldenResourceByPid(BaseResourcePersistentId<?> theGoldenResourcePid, String theResourceType) {
IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theResourceType);
return (IAnyResource) resourceDao.readByPid(theGoldenResourcePid);
}

View File

@ -66,7 +66,7 @@ public class FindCandidateByEidSvc extends BaseCandidateFinder {
if (isNoMatch(foundGoldenResource, theIncomingResource)) {
continue;
}
BaseResourcePersistentId 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

@ -114,7 +114,7 @@ public class FindCandidateByExampleSvc extends BaseCandidateFinder {
}
private List<BaseResourcePersistentId> getNoMatchGoldenResourcePids(IBaseResource theBaseResource) {
BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource);
BaseResourcePersistentId<?> targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theBaseResource);
return myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(targetPid, MdmMatchResultEnum.NO_MATCH)
.stream()
.map(IMdmLink::getGoldenResourcePersistenceId)

View File

@ -47,11 +47,11 @@ public class FindCandidateByLinkSvc extends BaseCandidateFinder {
protected List<MatchedGoldenResourceCandidate> findMatchGoldenResourceCandidates(IAnyResource theTarget) {
List<MatchedGoldenResourceCandidate> retval = new ArrayList<>();
BaseResourcePersistentId 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()) {
BaseResourcePersistentId 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

@ -26,20 +26,20 @@ import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId;
public class MatchedGoldenResourceCandidate {
private final BaseResourcePersistentId myCandidateGoldenResourcePid;
private final BaseResourcePersistentId<?> myCandidateGoldenResourcePid;
private final MdmMatchOutcome myMdmMatchOutcome;
public MatchedGoldenResourceCandidate(BaseResourcePersistentId theCandidate, MdmMatchOutcome theMdmMatchOutcome) {
public MatchedGoldenResourceCandidate(BaseResourcePersistentId<?> theCandidate, MdmMatchOutcome theMdmMatchOutcome) {
myCandidateGoldenResourcePid = theCandidate;
myMdmMatchOutcome = theMdmMatchOutcome;
}
public MatchedGoldenResourceCandidate(BaseResourcePersistentId theGoldenResourcePid, IMdmLink theMdmLink) {
public MatchedGoldenResourceCandidate(BaseResourcePersistentId<?> theGoldenResourcePid, IMdmLink theMdmLink) {
myCandidateGoldenResourcePid = theGoldenResourcePid;
myMdmMatchOutcome = new MdmMatchOutcome(theMdmLink.getVector(), theMdmLink.getScore()).setMatchResultEnum(theMdmLink.getMatchResult());
}
public BaseResourcePersistentId getCandidateGoldenResourcePid() {
public BaseResourcePersistentId<?> getCandidateGoldenResourcePid() {
return myCandidateGoldenResourcePid;
}

View File

@ -75,7 +75,7 @@ public class MdmCandidateSearchSvc {
*/
@Transactional
public Collection<IAnyResource> findCandidates(String theResourceType, IAnyResource theResource, RequestPartitionId theRequestPartitionId) {
Map<BaseResourcePersistentId, 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<BaseResourcePersistentId, 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

@ -77,7 +77,7 @@ public class MdmGoldenResourceFindingSvc {
}
public IAnyResource getGoldenResourceFromMatchedGoldenResourceCandidate(MatchedGoldenResourceCandidate theMatchedGoldenResourceCandidate, String theResourceType) {
BaseResourcePersistentId goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid();
BaseResourcePersistentId<?> goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid();
return myMdmResourceDaoSvc.readGoldenResourceByPid(goldenResourcePid, theResourceType);
}
}

View File

@ -35,8 +35,8 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher<IAnyReso
}
@Nullable
protected BaseResourcePersistentId getMatchedResourcePidFromResource(IAnyResource theResource) {
BaseResourcePersistentId retval;
protected BaseResourcePersistentId<?> getMatchedResourcePidFromResource(IAnyResource theResource) {
BaseResourcePersistentId<?> retval;
boolean isGoldenRecord = MdmResourceUtil.isMdmManaged(theResource);
if (isGoldenRecord) {
@ -71,7 +71,7 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher<IAnyReso
}
protected List<? extends IMdmLink> getMdmLinksForTarget(IAnyResource theTargetResource, MdmMatchResultEnum theMatchResult) {
BaseResourcePersistentId 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

@ -17,7 +17,7 @@ import java.util.stream.Collectors;
public class IsLinkedTo extends BaseGoldenResourceMatcher {
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
private BaseResourcePersistentId<?> incomingResourceGoldenResourcePid;
protected IsLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);

View File

@ -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 BaseResourcePersistentId incomingGoldenResourcePid;
private BaseResourcePersistentId<?> incomingGoldenResourcePid;
protected IsPossibleDuplicateOf(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);

View File

@ -18,7 +18,7 @@ import java.util.stream.Collectors;
public class IsPossibleLinkedTo extends BaseGoldenResourceMatcher {
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
private BaseResourcePersistentId<?> incomingResourceGoldenResourcePid;
protected IsPossibleLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theTargetResources) {
super(theIdHelperService, theMdmLinkDaoSvc, theTargetResources);

View File

@ -13,7 +13,7 @@ import java.util.stream.Collectors;
public class IsSameGoldenResourceAs extends BaseGoldenResourceMatcher {
private List<BaseResourcePersistentId> goldenResourcePidsToMatch;
private BaseResourcePersistentId incomingGoldenResourcePid;
private BaseResourcePersistentId<?> incomingGoldenResourcePid;
public IsSameGoldenResourceAs(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);

View File

@ -768,7 +768,7 @@ public class ResourceTable extends BaseHasResource implements Serializable, IBas
}
@Override
public BaseResourcePersistentId getPersistentId() {
public BaseResourcePersistentId<?> getPersistentId() {
return new JpaPid(getId());
}

View File

@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
public class ResourcePersistentIdMap {
private final Map<IIdType, BaseResourcePersistentId> myMap = new HashMap<>();
private final Map<IIdType, BaseResourcePersistentId<?>> myMap = new HashMap<>();
public static ResourcePersistentIdMap fromResourcePersistentIds(List<BaseResourcePersistentId> theResourcePersistentIds) {
ResourcePersistentIdMap retval = new ResourcePersistentIdMap();
@ -36,7 +36,7 @@ public class ResourcePersistentIdMap {
return retval;
}
private void add(BaseResourcePersistentId 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 BaseResourcePersistentId 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, BaseResourcePersistentId thePid) {
public void put(IIdType theId, BaseResourcePersistentId<?> thePid) {
myMap.put(theId, thePid);
}

View File

@ -390,7 +390,7 @@ public class SearchParamExtractorService {
}
IIdType referenceElement = thePathAndRef.getRef().getReferenceElement();
BaseResourcePersistentId resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement);
BaseResourcePersistentId<?> resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement);
ResourceLink resourceLink;
Long targetVersionId = nextId.getVersionIdPartAsLong();

View File

@ -340,7 +340,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
ourLog.info("Triggering job[{}] delivering {} resources", theJobDetails.getJobId(), resourceIds.size());
int highestIndexSubmitted = theJobDetails.getCurrentSearchLastUploadedIndex();
for (BaseResourcePersistentId 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

@ -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 (BaseResourcePersistentId nextPid : pids) {
for (BaseResourcePersistentId<?> nextPid : pids) {
Patient pt = new Patient();
pt.setId(nextPid.toString());
resources.add(pt);

View File

@ -101,7 +101,7 @@ public class ResourceVersionSvcTest {
));
}
BaseResourcePersistentId 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, BaseResourcePersistentId> 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 BaseResourcePersistentId MyPid;
public BaseResourcePersistentId<?> MyPid;
public Long MyVersion;
public ResourceIdPackage(IIdType id,
BaseResourcePersistentId pid,
BaseResourcePersistentId<?> pid,
Long version) {
MyResourceId = id;
MyPid = pid;

View File

@ -32,11 +32,11 @@ public interface IMdmLinkExpandSvc {
Set<String> expandMdmBySourceResourceId(IIdType theId);
Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid);
Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId<?> theSourceResourcePid);
Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId<?> theGoldenResourcePid);
Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid);
Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId<?> theGoldenResourcePid);
Set<String> expandMdmByGoldenResourceId(IdDt theId);
}

View File

@ -37,15 +37,15 @@ import java.util.List;
import java.util.Optional;
public interface IMdmLinkDao<T extends IMdmLink> {
int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid);
int deleteWithAnyReferenceToPid(BaseResourcePersistentId<?> thePid);
int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult);
int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId<?> thePid, MdmMatchResultEnum theMatchResult);
List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId<?> theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum);
List<BaseResourcePersistentId> findPidByResourceNameAndThreshold(String theResourceName, Date theHighThreshold, Pageable thePageable);
@ -53,7 +53,7 @@ public interface IMdmLinkDao<T extends IMdmLink> {
List<T> findAllById(List<BaseResourcePersistentId> thePids);
Optional<T> findById(BaseResourcePersistentId thePid);
Optional<T> findById(BaseResourcePersistentId<?> thePid);
void deleteAll(List<T> theLinks);
@ -75,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(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatch);
Optional<? extends IMdmLink> findBySourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMatch);
void deleteLinksWithAnyReferenceToPids(List<BaseResourcePersistentId> theResourcePersistentIds);
}

View File

@ -47,7 +47,7 @@ public class MdmLinkDeleteSvc {
* @return the number of records deleted
*/
public int deleteWithAnyReferenceTo(IBaseResource theResource) {
BaseResourcePersistentId 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) {
BaseResourcePersistentId 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

@ -88,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(BaseResourcePersistentId 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);
@ -102,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(BaseResourcePersistentId 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);
@ -117,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(BaseResourcePersistentId 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);
@ -126,12 +126,12 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc {
@Override
public Set<String> expandMdmByGoldenResourceId(IdDt theId) {
ourLog.debug("About to expand golden resource with golden resource id {}", theId);
BaseResourcePersistentId pidOrThrowException = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theId);
BaseResourcePersistentId<?> pidOrThrowException = myIdHelperService.getPidOrThrowException(RequestPartitionId.allPartitions(), theId);
return expandMdmByGoldenResourcePid(pidOrThrowException);
}
@Nonnull
public Set<String> flattenPidTuplesToSet(BaseResourcePersistentId initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
public Set<String> flattenPidTuplesToSet(BaseResourcePersistentId<?> initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
Set<BaseResourcePersistentId> flattenedPids = new HashSet<>();
goldenPidSourcePidTuples.forEach(tuple -> {
flattenedPids.add(tuple.getSourcePid());

View File

@ -29,7 +29,7 @@ import java.util.Objects;
* a Long, a String, or something else.
*/
public abstract class BaseResourcePersistentId<T> {
public static final BaseResourcePersistentId NOT_FOUND = new NotFoundPid();
public static final NotFoundPid NOT_FOUND = new NotFoundPid();
private Long myVersion;
private final String myResourceType;
// TODO KHS can this be final?

View File

@ -54,12 +54,12 @@ import java.util.function.Supplier;
*/
public class TransactionDetails {
public static final BaseResourcePersistentId NOT_FOUND = BaseResourcePersistentId.NOT_FOUND;
public static final NotFoundPid NOT_FOUND = BaseResourcePersistentId.NOT_FOUND;
private final Date myTransactionDate;
private List<Runnable> myRollbackUndoActions = Collections.emptyList();
private Map<String, BaseResourcePersistentId> myResolvedResourceIds = Collections.emptyMap();
private Map<String, BaseResourcePersistentId> 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 BaseResourcePersistentId 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 BaseResourcePersistentId 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, BaseResourcePersistentId> 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 BaseResourcePersistentId 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 BaseResourcePersistentId 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

@ -80,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<BaseResourcePersistentId> 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()) {
BaseResourcePersistentId pid = pidIterator.next();
BaseResourcePersistentId<?> pid = pidIterator.next();
Id id;
if (pid.getResourceType() != null) {

View File

@ -124,7 +124,7 @@ public class ConsumeFilesStep implements ILastJobStepWorker<BulkImportJobParamet
List<IIdType> idsList = new ArrayList<>(ids.keySet());
List<BaseResourcePersistentId> resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true);
for (BaseResourcePersistentId next : resolvedIds) {
for (BaseResourcePersistentId<?> next : resolvedIds) {
IIdType resId = next.getAssociatedResourceId();
theTransactionDetails.addResolvedResourceId(resId, next);
ids.remove(resId);

View File

@ -75,7 +75,7 @@ public class Id implements IModelJson {
return new HashCodeBuilder(17, 37).append(myResourceType).append(myId).toHashCode();
}
public static Id getIdFromPID(BaseResourcePersistentId 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

@ -61,7 +61,7 @@ public class ReindexStep implements IJobStepWorker<ReindexJobParameters, Resourc
@Autowired
private DaoRegistry myDaoRegistry;
@Autowired
private IIdHelperService<BaseResourcePersistentId> 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<BaseResourcePersistentId> persistentIds = myData.getResourcePersistentIds(myIdHelperService);
List<? extends BaseResourcePersistentId> persistentIds = myData.getResourcePersistentIds(myIdHelperService);
ourLog.info("Starting reindex work chunk with {} resources - Instance[{}] Chunk[{}]", persistentIds.size(), myInstanceId, myChunkId);
StopWatch sw = new StopWatch();

View File

@ -202,7 +202,7 @@ public class FetchResourceIdsStepTest {
// verify all submitted ids are there
boolean found = false;
for (BaseResourcePersistentId pid : patientIds) {
for (BaseResourcePersistentId<?> pid : patientIds) {
Id id = Id.getIdFromPID(pid, "Patient");
for (ResourceIdList idList : listIds) {
found = idList.getIds().contains(id);

View File

@ -84,7 +84,7 @@ public class MdmInflateAndSubmitResourcesStep implements IJobStepWorker<MdmSubmi
private List<IBaseResource> fetchAllResources(List<? extends BaseResourcePersistentId> theIds) {
List<IBaseResource> resources = new ArrayList<>();
for (BaseResourcePersistentId 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

@ -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(BaseResourcePersistentId 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(BaseResourcePersistentId thePid, boolean theDeletedOk) {
default T readByPid(BaseResourcePersistentId<?> thePid, boolean theDeletedOk) {
throw new UnsupportedOperationException(Msg.code(571));
}
@ -343,5 +343,5 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
*
* @param theResourcePersistentId The ID
*/
void reindex(BaseResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
void reindex(BaseResourcePersistentId<?> theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
}

View File

@ -31,7 +31,7 @@ public class DaoMethodOutcome extends MethodOutcome {
private IBasePersistedResource myEntity;
private IBaseResource myPreviousResource;
private boolean myNop;
private BaseResourcePersistentId myResourcePersistentId;
private BaseResourcePersistentId<?> myResourcePersistentId;
private RestOperationTypeEnum myOperationType;
private String myMatchUrl;
@ -104,11 +104,11 @@ public class DaoMethodOutcome extends MethodOutcome {
return this;
}
public BaseResourcePersistentId getPersistentId() {
public BaseResourcePersistentId<?> getPersistentId() {
return myResourcePersistentId;
}
public DaoMethodOutcome setPersistentId(BaseResourcePersistentId theResourcePersistentId) {
public DaoMethodOutcome setPersistentId(BaseResourcePersistentId<?> theResourcePersistentId) {
myResourcePersistentId = theResourcePersistentId;
return this;
}

View File

@ -36,7 +36,7 @@ public class LazyDaoMethodOutcome extends DaoMethodOutcome {
/**
* Constructor
*/
public LazyDaoMethodOutcome(BaseResourcePersistentId theResourcePersistentId) {
public LazyDaoMethodOutcome(BaseResourcePersistentId<?> theResourcePersistentId) {
setPersistentId(theResourcePersistentId);
}

View File

@ -72,7 +72,7 @@ abstract public class BaseResourcePidList implements IResourcePidList {
return Collections.unmodifiableList(myIds);
}
public BaseResourcePersistentId getId(int theIndex) {
public BaseResourcePersistentId<?> getId(int theIndex) {
return myIds.get(theIndex);
}
}

View File

@ -27,9 +27,9 @@ import java.util.Objects;
public class TypedResourcePid {
public final String resourceType;
public final BaseResourcePersistentId id;
public final BaseResourcePersistentId<?> id;
public TypedResourcePid(String theResourceType, BaseResourcePersistentId theId) {
public TypedResourcePid(String theResourceType, BaseResourcePersistentId<?> theId) {
this.resourceType = theResourceType;
this.id = theId;
}

View File

@ -39,7 +39,7 @@ import java.util.Optional;
import java.util.Set;
/**
* This interface is used to translate between {@link BaseResourcePersistentId}
* This interface is used to translate between {@link BaseResourcePersistentId<?>}
* and actual resource IDs.
*/
public interface IIdHelperService<T extends BaseResourcePersistentId> {

View File

@ -318,7 +318,7 @@ public abstract class BaseStorageDao {
return outcome;
}
protected DaoMethodOutcome toMethodOutcomeLazy(RequestDetails theRequest, BaseResourcePersistentId 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

@ -81,7 +81,7 @@ public abstract class BaseStorageResourceDao<T extends IBaseResource> extends Ba
String msg = getContext().getLocalizer().getMessageSanitized(BaseStorageDao.class, "transactionOperationWithMultipleMatchFailure", "PATCH", theConditionalUrl, match.size());
throw new PreconditionFailedException(Msg.code(972) + msg);
} else if (match.size() == 1) {
BaseResourcePersistentId 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(BaseResourcePersistentId 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

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

View File

@ -48,12 +48,12 @@ public class ExpungeOperation implements Callable<ExpungeOutcome> {
private DaoConfig myDaoConfig;
private final String myResourceName;
private final BaseResourcePersistentId myResourceId;
private final BaseResourcePersistentId<?> myResourceId;
private final ExpungeOptions myExpungeOptions;
private final RequestDetails myRequestDetails;
private final AtomicInteger myRemainingCount;
public ExpungeOperation(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
public ExpungeOperation(String theResourceName, BaseResourcePersistentId<?> theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
myResourceName = theResourceName;
myResourceId = theResourceId;
myExpungeOptions = theExpungeOptions;

View File

@ -43,11 +43,11 @@ public class ExpungeService {
@Autowired
private ApplicationContext myApplicationContext;
protected ExpungeOperation getExpungeOperation(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
protected ExpungeOperation getExpungeOperation(String theResourceName, BaseResourcePersistentId<?> theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {
return myApplicationContext.getBean(ExpungeOperation.class, theResourceName, theResourceId, theExpungeOptions, theRequestDetails);
}
public ExpungeOutcome expunge(String theResourceName, BaseResourcePersistentId theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequest) {
public ExpungeOutcome expunge(String theResourceName, BaseResourcePersistentId<?> theResourceId, ExpungeOptions theExpungeOptions, RequestDetails theRequest) {
ourLog.info("Expunge: ResourceName[{}] Id[{}] Version[{}] Options[{}]", theResourceName, theResourceId != null ? theResourceId.getId() : null, theResourceId != null ? theResourceId.getVersion() : null, theExpungeOptions);
ExpungeOperation expungeOperation = getExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequest);
@ -65,7 +65,7 @@ public class ExpungeService {
return expungeOperation.call();
}
public void deleteAllSearchParams(BaseResourcePersistentId theResourceId) {
public void deleteAllSearchParams(BaseResourcePersistentId<?> theResourceId) {
myExpungeDaoService.deleteAllSearchParams(theResourceId);
}
}

View File

@ -183,7 +183,7 @@ public class DaoResourceLinkResolver<T extends BaseResourcePersistentId> impleme
valueOf = placeholderResourceDao.create(newResource, theRequest).getEntity();
}
BaseResourcePersistentId persistentId = valueOf.getPersistentId();
BaseResourcePersistentId<?> persistentId = valueOf.getPersistentId();
persistentId = myIdHelperService.newPid(persistentId.getId());
persistentId.setAssociatedResourceId(valueOf.getIdDt());
theTransactionDetails.addResolvedResourceId(persistentId.getAssociatedResourceId(), persistentId);