add <?> to Base so we can extract interface
This commit is contained in:
parent
fd1be0049a
commit
a806f3d2bc
|
@ -680,7 +680,7 @@ public class JpaConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope("prototype")
|
@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);
|
return new ExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequestDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1133,13 +1133,13 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public T readByPid(BaseResourcePersistentId thePid) {
|
public T readByPid(BaseResourcePersistentId<?> thePid) {
|
||||||
return readByPid(thePid, false);
|
return readByPid(thePid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public T readByPid(BaseResourcePersistentId thePid, boolean theDeletedOk) {
|
public T readByPid(BaseResourcePersistentId<?> thePid, boolean theDeletedOk) {
|
||||||
StopWatch w = new StopWatch();
|
StopWatch w = new StopWatch();
|
||||||
JpaPid jpaPid = (JpaPid) thePid;
|
JpaPid jpaPid = (JpaPid) thePid;
|
||||||
|
|
||||||
|
@ -1230,7 +1230,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@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());
|
Optional<ResourceTable> entityOpt = myResourceTableDao.findById(((JpaPid) theJpaPid).getId());
|
||||||
if (!entityOpt.isPresent()) {
|
if (!entityOpt.isPresent()) {
|
||||||
ourLog.warn("Unable to find entity with PID: {}", ((JpaPid) theJpaPid).getId());
|
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
|
@Override
|
||||||
protected IBasePersistedResource readEntityLatestVersion(BaseResourcePersistentId thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails) {
|
protected IBasePersistedResource readEntityLatestVersion(BaseResourcePersistentId<?> thePersistentId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails) {
|
||||||
JpaPid jpaPid = (JpaPid) thePersistentId;
|
JpaPid jpaPid = (JpaPid) thePersistentId;
|
||||||
return myEntityManager.find(ResourceTable.class, jpaPid.getId());
|
return myEntityManager.find(ResourceTable.class, jpaPid.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
|
|
||||||
// keep this in sync with supportsSomeOf();
|
// keep this in sync with supportsSomeOf();
|
||||||
private ISearchQueryExecutor doSearch(String theResourceType, SearchParameterMap theParams,
|
private ISearchQueryExecutor doSearch(String theResourceType, SearchParameterMap theParams,
|
||||||
BaseResourcePersistentId theReferencingPid, Integer theMaxResultsToFetch) {
|
BaseResourcePersistentId<?> theReferencingPid, Integer theMaxResultsToFetch) {
|
||||||
|
|
||||||
int offset = theParams.getOffset() == null ? 0 : theParams.getOffset();
|
int offset = theParams.getOffset() == null ? 0 : theParams.getOffset();
|
||||||
int count = getMaxFetchSize(theParams, theMaxResultsToFetch);
|
int count = getMaxFetchSize(theParams, theMaxResultsToFetch);
|
||||||
|
@ -186,7 +186,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
|
|
||||||
|
|
||||||
private SearchQueryOptionsStep<?, Long, SearchLoadingOptionsStep, ?, ?> getSearchQueryOptionsStep(
|
private SearchQueryOptionsStep<?, Long, SearchLoadingOptionsStep, ?, ?> getSearchQueryOptionsStep(
|
||||||
String theResourceType, SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) {
|
String theResourceType, SearchParameterMap theParams, BaseResourcePersistentId<?> theReferencingPid) {
|
||||||
|
|
||||||
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
|
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
|
||||||
var query= getSearchSession().search(ResourceTable.class)
|
var query= getSearchSession().search(ResourceTable.class)
|
||||||
|
@ -214,7 +214,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
|
|
||||||
|
|
||||||
private PredicateFinalStep buildWhereClause(SearchPredicateFactory f, String theResourceType,
|
private PredicateFinalStep buildWhereClause(SearchPredicateFactory f, String theResourceType,
|
||||||
SearchParameterMap theParams, BaseResourcePersistentId theReferencingPid) {
|
SearchParameterMap theParams, BaseResourcePersistentId<?> theReferencingPid) {
|
||||||
return f.bool(b -> {
|
return f.bool(b -> {
|
||||||
ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f);
|
ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class JpaResourceDaoCodeSystem<T extends IBaseResource> extends BaseHapiF
|
||||||
List<IIdType> valueSetIds;
|
List<IIdType> valueSetIds;
|
||||||
List<BaseResourcePersistentId> 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<>();
|
valueSetIds = new ArrayList<>();
|
||||||
for (BaseResourcePersistentId next : ids) {
|
for (BaseResourcePersistentId<?> next : ids) {
|
||||||
IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next);
|
IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next);
|
||||||
valueSetIds.add(id);
|
valueSetIds.add(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* 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
|
* anyhow. The equivalents in {@link IIdHelperService} are probably a bit more
|
||||||
* clunky because you have to convert between {@link Long} and
|
* 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
|
* but they also have caching and partition awareness so the tradeoff for that
|
||||||
* extra effort is that they are better.
|
* extra effort is that they are better.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -93,7 +93,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
* <p>
|
* <p>
|
||||||
* This service is highly optimized in order to minimize the number of DB calls as much as possible,
|
* 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
|
* 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
|
* The former involves an extra database join that the latter does not require, so selecting the
|
||||||
* right method here is important.
|
* right method here is important.
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -626,7 +626,7 @@ public class IdHelperService implements IIdHelperService<JpaPid> {
|
||||||
retVal.put(nextResourcePid, Optional.empty());
|
retVal.put(nextResourcePid, Optional.empty());
|
||||||
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.PID_TO_FORCED_ID, 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(
|
retVal.forEach(
|
||||||
(k, v) -> {
|
(k, v) -> {
|
||||||
convertRetVal.put(new JpaPid(k), v);
|
convertRetVal.put(new JpaPid(k), v);
|
||||||
|
|
|
@ -66,17 +66,17 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
|
||||||
private IIdHelperService myIdHelperService;
|
private IIdHelperService myIdHelperService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteWithAnyReferenceToPid(BaseResourcePersistentId thePid) {
|
public int deleteWithAnyReferenceToPid(BaseResourcePersistentId<?> thePid) {
|
||||||
return myMdmLinkDao.deleteWithAnyReferenceToPid(((JpaPid) thePid).getId());
|
return myMdmLinkDao.deleteWithAnyReferenceToPid(((JpaPid) thePid).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId thePid, MdmMatchResultEnum theMatchResult) {
|
public int deleteWithAnyReferenceToPidAndMatchResultNot(BaseResourcePersistentId<?> thePid, MdmMatchResultEnum theMatchResult) {
|
||||||
return myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(((JpaPid) thePid).getId(), theMatchResult);
|
return myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(((JpaPid) thePid).getId(), theMatchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
public List<MdmPidTuple> expandPidsFromGroupPidGivenMatchResult(BaseResourcePersistentId<?> theGroupPid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
||||||
return myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(((JpaPid) theGroupPid).getId(), theMdmMatchResultEnum)
|
return myMdmLinkDao.expandPidsFromGroupPidGivenMatchResult(((JpaPid) theGroupPid).getId(), theMdmMatchResultEnum)
|
||||||
.stream()
|
.stream()
|
||||||
.map( theMdmPidTuple -> new MdmPidTuple()
|
.map( theMdmPidTuple -> new MdmPidTuple()
|
||||||
|
@ -86,7 +86,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
public List<MdmPidTuple> expandPidsBySourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
||||||
return myMdmLinkDao.expandPidsBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum)
|
return myMdmLinkDao.expandPidsBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum)
|
||||||
.stream()
|
.stream()
|
||||||
.map( theMdmPidTuple -> new MdmPidTuple()
|
.map( theMdmPidTuple -> new MdmPidTuple()
|
||||||
|
@ -96,7 +96,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
public List<MdmPidTuple> expandPidsByGoldenResourcePidAndMatchResult(BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMdmMatchResultEnum) {
|
||||||
return myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum)
|
return myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMdmMatchResultEnum)
|
||||||
.stream()
|
.stream()
|
||||||
.map( theMdmPidTuple -> new MdmPidTuple()
|
.map( theMdmPidTuple -> new MdmPidTuple()
|
||||||
|
@ -128,7 +128,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<MdmLink> findById(BaseResourcePersistentId thePid) {
|
public Optional<MdmLink> findById(BaseResourcePersistentId<?> thePid) {
|
||||||
return myMdmLinkDao.findById(((JpaPid) thePid).getId());
|
return myMdmLinkDao.findById(((JpaPid) thePid).getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao<MdmLink> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return myMdmLinkDao.findBySourcePidAndMatchResult(((JpaPid) theSourcePid).getId(), theMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void storeNewCodeSystemVersion(BaseResourcePersistentId theCodeSystemResourcePid, String theSystemUri,
|
public void storeNewCodeSystemVersion(BaseResourcePersistentId<?> theCodeSystemResourcePid, String theSystemUri,
|
||||||
String theSystemName, String theCodeSystemVersionId, TermCodeSystemVersion theCodeSystemVersion,
|
String theSystemName, String theCodeSystemVersionId, TermCodeSystemVersion theCodeSystemVersion,
|
||||||
ResourceTable theCodeSystemResourceTable, RequestDetails theRequestDetails) {
|
ResourceTable theCodeSystemResourceTable, RequestDetails theRequestDetails) {
|
||||||
assert TransactionSynchronizationManager.isActualTransactionActive();
|
assert TransactionSynchronizationManager.isActualTransactionActive();
|
||||||
|
@ -630,7 +630,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@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);
|
TermCodeSystem codeSystem = myCodeSystemDao.findByCodeSystemUri(theSystemUri);
|
||||||
if (codeSystem == null) {
|
if (codeSystem == null) {
|
||||||
codeSystem = myCodeSystemDao.findByResourcePid(((JpaPid) theCodeSystemResourcePid).getId());
|
codeSystem = myCodeSystemDao.findByResourcePid(((JpaPid) theCodeSystemResourcePid).getId());
|
||||||
|
|
|
@ -1695,7 +1695,7 @@ public class TermReadSvcImpl implements ITermReadSvc {
|
||||||
.setMessage("Unable to validate code " + theSystem + "#" + theCode + theAppend);
|
.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();
|
assert TransactionSynchronizationManager.isSynchronizationActive();
|
||||||
|
|
||||||
List<TermValueSetConcept> retVal = new ArrayList<>();
|
List<TermValueSetConcept> retVal = new ArrayList<>();
|
||||||
|
|
|
@ -50,7 +50,7 @@ public interface ITermCodeSystemStorageSvc {
|
||||||
(boolean) theRequestDetails.getUserData().getOrDefault(MAKE_LOADING_VERSION_CURRENT, Boolean.TRUE);
|
(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,
|
String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable,
|
||||||
RequestDetails theRequestDetails);
|
RequestDetails theRequestDetails);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public interface ITermCodeSystemStorageSvc {
|
||||||
* Default implementation supports previous signature of method which was added RequestDetails parameter
|
* Default implementation supports previous signature of method which was added RequestDetails parameter
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@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) {
|
String theSystemVersionId, TermCodeSystemVersion theCodeSystemVersion, ResourceTable theCodeSystemResourceTable) {
|
||||||
|
|
||||||
storeNewCodeSystemVersion(theCodeSystemResourcePid, theSystemUri, theSystemName, theSystemVersionId,
|
storeNewCodeSystemVersion(theCodeSystemResourcePid, theSystemUri, theSystemName, theSystemVersionId,
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class JpaBulkExportProcessorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResourcePersistentId next() {
|
public BaseResourcePersistentId<?> next() {
|
||||||
return myList.get(index++);
|
return myList.get(index++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,12 +159,12 @@ public class JpaBulkExportProcessorTest {
|
||||||
private MdmPidTuple createTuple(long theGroupId, long theGoldenId) {
|
private MdmPidTuple createTuple(long theGroupId, long theGoldenId) {
|
||||||
return new MdmPidTuple() {
|
return new MdmPidTuple() {
|
||||||
@Override
|
@Override
|
||||||
public BaseResourcePersistentId getGoldenPid() {
|
public BaseResourcePersistentId<?> getGoldenPid() {
|
||||||
return new JpaPid(theGoldenId);
|
return new JpaPid(theGoldenId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResourcePersistentId getSourcePid() {
|
public BaseResourcePersistentId<?> getSourcePid() {
|
||||||
return new JpaPid(theGroupId);
|
return new JpaPid(theGroupId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -292,8 +292,8 @@ public class JpaBulkExportProcessorTest {
|
||||||
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
|
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
|
||||||
.thenAnswer(params -> {
|
.thenAnswer(params -> {
|
||||||
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
|
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
|
||||||
HashMap<BaseResourcePersistentId, Optional<String>> answer = new HashMap<>();
|
HashMap<BaseResourcePersistentId<?>, Optional<String>> answer = new HashMap<>();
|
||||||
for (BaseResourcePersistentId l : uniqPids) {
|
for (BaseResourcePersistentId<?> l : uniqPids) {
|
||||||
answer.put(l, Optional.empty());
|
answer.put(l, Optional.empty());
|
||||||
}
|
}
|
||||||
return new PersistentIdToForcedIdMap(answer);
|
return new PersistentIdToForcedIdMap(answer);
|
||||||
|
@ -386,8 +386,8 @@ public class JpaBulkExportProcessorTest {
|
||||||
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
|
when(myIdHelperService.translatePidsToForcedIds(any(Set.class)))
|
||||||
.thenAnswer(params -> {
|
.thenAnswer(params -> {
|
||||||
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
|
Set<BaseResourcePersistentId> uniqPids = params.getArgument(0);
|
||||||
HashMap<BaseResourcePersistentId, Optional<String>> answer = new HashMap<>();
|
HashMap<BaseResourcePersistentId<?>, Optional<String>> answer = new HashMap<>();
|
||||||
for (BaseResourcePersistentId l : uniqPids) {
|
for (BaseResourcePersistentId<?> l : uniqPids) {
|
||||||
answer.put(l, Optional.empty());
|
answer.put(l, Optional.empty());
|
||||||
}
|
}
|
||||||
return new PersistentIdToForcedIdMap(answer);
|
return new PersistentIdToForcedIdMap(answer);
|
||||||
|
@ -445,7 +445,7 @@ public class JpaBulkExportProcessorTest {
|
||||||
assertTrue(iterator.hasNext());
|
assertTrue(iterator.hasNext());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
BaseResourcePersistentId ret = iterator.next();
|
BaseResourcePersistentId<?> ret = iterator.next();
|
||||||
assertTrue(
|
assertTrue(
|
||||||
ret.equals(pid) || ret.equals(pid2)
|
ret.equals(pid) || ret.equals(pid2)
|
||||||
);
|
);
|
||||||
|
|
|
@ -95,8 +95,8 @@ public class MdmLinkDaoSvc {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
|
public IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
|
||||||
BaseResourcePersistentId goldenResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
BaseResourcePersistentId<?> goldenResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
||||||
BaseResourcePersistentId sourceResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource);
|
BaseResourcePersistentId<?> sourceResourcePid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource);
|
||||||
Optional<? extends IMdmLink> oExisting = getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourcePid, sourceResourcePid);
|
Optional<? extends IMdmLink> oExisting = getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourcePid, sourceResourcePid);
|
||||||
if (oExisting.isPresent()) {
|
if (oExisting.isPresent()) {
|
||||||
return oExisting.get();
|
return oExisting.get();
|
||||||
|
@ -126,7 +126,7 @@ public class MdmLinkDaoSvc {
|
||||||
* @param theSourceResourcePid The ResourcepersistenceId of the Source resource
|
* @param theSourceResourcePid The ResourcepersistenceId of the Source resource
|
||||||
* @return The {@link IMdmLink} entity that matches these criteria if exists
|
* @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) {
|
if (theSourceResourcePid == null || theGoldenResourcePid == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class MdmLinkDaoSvc {
|
||||||
* @param theMatchResult the Match Result of the relationship
|
* @param theMatchResult the Match Result of the relationship
|
||||||
* @return a list of {@link IMdmLink} entities matching these criteria.
|
* @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();
|
IMdmLink exampleLink = myMdmLinkFactory.newMdmLink();
|
||||||
exampleLink.setSourcePersistenceId(theSourcePid);
|
exampleLink.setSourcePersistenceId(theSourcePid);
|
||||||
exampleLink.setMatchResult(theMatchResult);
|
exampleLink.setMatchResult(theMatchResult);
|
||||||
|
@ -161,7 +161,7 @@ public class MdmLinkDaoSvc {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Transactional
|
@Transactional
|
||||||
public Optional<? extends IMdmLink> getMatchedLinkForSourcePid(BaseResourcePersistentId theSourcePid) {
|
public Optional<? extends IMdmLink> getMatchedLinkForSourcePid(BaseResourcePersistentId<?> theSourcePid) {
|
||||||
return myMdmLinkDao.findBySourcePidAndMatchResult(theSourcePid, MdmMatchResultEnum.MATCH);
|
return myMdmLinkDao.findBySourcePidAndMatchResult(theSourcePid, MdmMatchResultEnum.MATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public class MdmLinkDaoSvc {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private Optional<? extends IMdmLink> getMdmLinkWithMatchResult(IBaseResource theSourceResource, MdmMatchResultEnum theMatchResult) {
|
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) {
|
if (pid == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,8 @@ public class MdmLinkDaoSvc {
|
||||||
return getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(new JpaPid(theGoldenResourcePid), new JpaPid(theSourcePid), theMatchResult);
|
return getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(new JpaPid(theGoldenResourcePid), new JpaPid(theSourcePid), theMatchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<? extends IMdmLink> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(BaseResourcePersistentId theGoldenResourcePid,
|
public Optional<? extends IMdmLink> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(BaseResourcePersistentId<?> theGoldenResourcePid,
|
||||||
BaseResourcePersistentId theSourcePid, MdmMatchResultEnum theMatchResult) {
|
BaseResourcePersistentId<?> theSourcePid, MdmMatchResultEnum theMatchResult) {
|
||||||
IMdmLink exampleLink = myMdmLinkFactory.newMdmLink();
|
IMdmLink exampleLink = myMdmLinkFactory.newMdmLink();
|
||||||
exampleLink.setGoldenResourcePersistenceId(theGoldenResourcePid);
|
exampleLink.setGoldenResourcePersistenceId(theGoldenResourcePid);
|
||||||
exampleLink.setSourcePersistenceId(theSourcePid);
|
exampleLink.setSourcePersistenceId(theSourcePid);
|
||||||
|
@ -231,7 +231,7 @@ public class MdmLinkDaoSvc {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Optional<? extends IMdmLink> findMdmLinkBySource(IBaseResource theSourceResource) {
|
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) {
|
if (pid == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public class MdmLinkDaoSvc {
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<? extends IMdmLink> findMdmLinksByGoldenResource(IBaseResource theGoldenResource) {
|
public List<? extends IMdmLink> findMdmLinksByGoldenResource(IBaseResource theGoldenResource) {
|
||||||
BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
BaseResourcePersistentId<?> pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
||||||
if (pid == null) {
|
if (pid == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ public class MdmLinkDaoSvc {
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<? extends IMdmLink> findMdmLinksBySourceResource(IBaseResource theSourceResource) {
|
public List<? extends IMdmLink> findMdmLinksBySourceResource(IBaseResource theSourceResource) {
|
||||||
BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource);
|
BaseResourcePersistentId<?> pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theSourceResource);
|
||||||
if (pid == null) {
|
if (pid == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ public class MdmLinkDaoSvc {
|
||||||
* @return all links for the source.
|
* @return all links for the source.
|
||||||
*/
|
*/
|
||||||
public List<? extends IMdmLink> findMdmMatchLinksByGoldenResource(IBaseResource theGoldenResource) {
|
public List<? extends IMdmLink> findMdmMatchLinksByGoldenResource(IBaseResource theGoldenResource) {
|
||||||
BaseResourcePersistentId pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
BaseResourcePersistentId<?> pid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theGoldenResource);
|
||||||
if (pid == null) {
|
if (pid == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class GoldenResourceMergerSvcImpl implements IGoldenResourceMergerSvc {
|
||||||
List<? extends IMdmLink> fromLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theFromResource); // fromLinks - links going to theFromResource
|
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<? extends IMdmLink> toLinks = myMdmLinkDaoSvc.findMdmLinksByGoldenResource(theToResource); // toLinks - links going to theToResource
|
||||||
List<IMdmLink> toDelete = new ArrayList<>();
|
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) {
|
for (IMdmLink fromLink : fromLinks) {
|
||||||
Optional<? extends IMdmLink> optionalToLink = findFirstLinkWithMatchingSource(toLinks, fromLink);
|
Optional<? extends IMdmLink> optionalToLink = findFirstLinkWithMatchingSource(toLinks, fromLink);
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class MdmEidUpdateService {
|
||||||
|
|
||||||
if (theExistingMatchOrPossibleMatchLink.isPresent()) {
|
if (theExistingMatchOrPossibleMatchLink.isPresent()) {
|
||||||
IMdmLink mdmLink = theExistingMatchOrPossibleMatchLink.get();
|
IMdmLink mdmLink = theExistingMatchOrPossibleMatchLink.get();
|
||||||
BaseResourcePersistentId existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId();
|
BaseResourcePersistentId<?> existingGoldenResourcePid = mdmLink.getGoldenResourcePersistenceId();
|
||||||
myExistingGoldenResource = myMdmResourceDaoSvc.readGoldenResourceByPid(existingGoldenResourcePid, resourceType);
|
myExistingGoldenResource = myMdmResourceDaoSvc.readGoldenResourceByPid(existingGoldenResourcePid, resourceType);
|
||||||
myRemainsMatchedToSameGoldenResource = candidateIsSameAsMdmLinkGoldenResource(mdmLink, theMatchedGoldenResourceCandidate);
|
myRemainsMatchedToSameGoldenResource = candidateIsSameAsMdmLinkGoldenResource(mdmLink, theMatchedGoldenResourceCandidate);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class MdmLinkCreateSvcImpl implements IMdmLinkCreateSvc {
|
||||||
|
|
||||||
validateCreateLinkRequest(theGoldenResource, theSourceResource, sourceType);
|
validateCreateLinkRequest(theGoldenResource, theSourceResource, sourceType);
|
||||||
|
|
||||||
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
BaseResourcePersistentId<?> goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
||||||
BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
BaseResourcePersistentId<?> targetId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
||||||
|
|
||||||
// check if the golden resource and the source resource are in the same partition, throw error if not
|
// check if the golden resource and the source resource are in the same partition, throw error if not
|
||||||
myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource);
|
myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource);
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class MdmLinkSvcImpl implements IMdmLinkSvc {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean goldenResourceLinkedAsNoMatch(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
|
private boolean goldenResourceLinkedAsNoMatch(IAnyResource theGoldenResource, IAnyResource theSourceResource) {
|
||||||
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
BaseResourcePersistentId<?> goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
||||||
BaseResourcePersistentId sourceId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
BaseResourcePersistentId<?> sourceId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
||||||
// TODO perf collapse into one query
|
// TODO perf collapse into one query
|
||||||
return myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(goldenResourceId, sourceId, MdmMatchResultEnum.NO_MATCH).isPresent() ||
|
return myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(goldenResourceId, sourceId, MdmMatchResultEnum.NO_MATCH).isPresent() ||
|
||||||
myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(sourceId, goldenResourceId, MdmMatchResultEnum.NO_MATCH).isPresent();
|
myMdmLinkDaoSvc.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(sourceId, goldenResourceId, MdmMatchResultEnum.NO_MATCH).isPresent();
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class MdmLinkUpdaterSvcImpl implements IMdmLinkUpdaterSvc {
|
||||||
|
|
||||||
validateUpdateLinkRequest(theGoldenResource, theSourceResource, theMatchResult, sourceType);
|
validateUpdateLinkRequest(theGoldenResource, theSourceResource, theMatchResult, sourceType);
|
||||||
|
|
||||||
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
BaseResourcePersistentId<?> goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
||||||
BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
BaseResourcePersistentId<?> targetId = myIdHelperService.getPidOrThrowException(theSourceResource);
|
||||||
|
|
||||||
// check if the golden resource and the source resource are in the same partition, throw error if not
|
// check if the golden resource and the source resource are in the same partition, throw error if not
|
||||||
myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource);
|
myMdmPartitionHelper.validateResourcesInSamePartition(theGoldenResource, theSourceResource);
|
||||||
|
@ -158,8 +158,8 @@ public class MdmLinkUpdaterSvcImpl implements IMdmLinkUpdaterSvc {
|
||||||
public void notDuplicateGoldenResource(IAnyResource theGoldenResource, IAnyResource theTargetGoldenResource, MdmTransactionContext theMdmContext) {
|
public void notDuplicateGoldenResource(IAnyResource theGoldenResource, IAnyResource theTargetGoldenResource, MdmTransactionContext theMdmContext) {
|
||||||
validateNotDuplicateGoldenResourceRequest(theGoldenResource, theTargetGoldenResource);
|
validateNotDuplicateGoldenResourceRequest(theGoldenResource, theTargetGoldenResource);
|
||||||
|
|
||||||
BaseResourcePersistentId goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
BaseResourcePersistentId<?> goldenResourceId = myIdHelperService.getPidOrThrowException(theGoldenResource);
|
||||||
BaseResourcePersistentId targetId = myIdHelperService.getPidOrThrowException(theTargetGoldenResource);
|
BaseResourcePersistentId<?> targetId = myIdHelperService.getPidOrThrowException(theTargetGoldenResource);
|
||||||
|
|
||||||
Optional<? extends IMdmLink> oMdmLink = myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourceId, targetId);
|
Optional<? extends IMdmLink> oMdmLink = myMdmLinkDaoSvc.getLinkByGoldenResourcePidAndSourceResourcePid(goldenResourceId, targetId);
|
||||||
if (!oMdmLink.isPresent()) {
|
if (!oMdmLink.isPresent()) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class MdmMatchLinkSvc {
|
||||||
|
|
||||||
private void handleMdmWithMultipleCandidates(IAnyResource theResource, CandidateList theCandidateList, MdmTransactionContext theMdmTransactionContext) {
|
private void handleMdmWithMultipleCandidates(IAnyResource theResource, CandidateList theCandidateList, MdmTransactionContext theMdmTransactionContext) {
|
||||||
MatchedGoldenResourceCandidate firstMatch = theCandidateList.getFirstMatch();
|
MatchedGoldenResourceCandidate firstMatch = theCandidateList.getFirstMatch();
|
||||||
BaseResourcePersistentId sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid();
|
BaseResourcePersistentId<?> sampleGoldenResourcePid = firstMatch.getCandidateGoldenResourcePid();
|
||||||
boolean allSameGoldenResource = theCandidateList.stream()
|
boolean allSameGoldenResource = theCandidateList.stream()
|
||||||
.allMatch(candidate -> candidate.getCandidateGoldenResourcePid().equals(sampleGoldenResourcePid));
|
.allMatch(candidate -> candidate.getCandidateGoldenResourcePid().equals(sampleGoldenResourcePid));
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MdmResourceDaoSvc {
|
||||||
resourceDao.removeTag(theGoldenResource.getIdElement(), TagTypeEnum.TAG, MdmConstants.SYSTEM_GOLDEN_RECORD_STATUS, MdmConstants.CODE_GOLDEN_RECORD, requestDetails);
|
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);
|
IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theResourceType);
|
||||||
return (IAnyResource) resourceDao.readByPid(theGoldenResourcePid);
|
return (IAnyResource) resourceDao.readByPid(theGoldenResourcePid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class FindCandidateByEidSvc extends BaseCandidateFinder {
|
||||||
if (isNoMatch(foundGoldenResource, theIncomingResource)) {
|
if (isNoMatch(foundGoldenResource, theIncomingResource)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BaseResourcePersistentId pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), foundGoldenResource);
|
BaseResourcePersistentId<?> pidOrNull = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), foundGoldenResource);
|
||||||
MatchedGoldenResourceCandidate mpc = new MatchedGoldenResourceCandidate(pidOrNull, MdmMatchOutcome.EID_MATCH);
|
MatchedGoldenResourceCandidate mpc = new MatchedGoldenResourceCandidate(pidOrNull, MdmMatchOutcome.EID_MATCH);
|
||||||
ourLog.debug("Incoming Resource {} matched Golden Resource {} by EID {}", theIncomingResource.getIdElement().toUnqualifiedVersionless(), foundGoldenResource.getIdElement().toUnqualifiedVersionless(), eid);
|
ourLog.debug("Incoming Resource {} matched Golden Resource {} by EID {}", theIncomingResource.getIdElement().toUnqualifiedVersionless(), foundGoldenResource.getIdElement().toUnqualifiedVersionless(), eid);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class FindCandidateByExampleSvc extends BaseCandidateFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BaseResourcePersistentId> getNoMatchGoldenResourcePids(IBaseResource theBaseResource) {
|
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)
|
return myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(targetPid, MdmMatchResultEnum.NO_MATCH)
|
||||||
.stream()
|
.stream()
|
||||||
.map(IMdmLink::getGoldenResourcePersistenceId)
|
.map(IMdmLink::getGoldenResourcePersistenceId)
|
||||||
|
|
|
@ -47,11 +47,11 @@ public class FindCandidateByLinkSvc extends BaseCandidateFinder {
|
||||||
protected List<MatchedGoldenResourceCandidate> findMatchGoldenResourceCandidates(IAnyResource theTarget) {
|
protected List<MatchedGoldenResourceCandidate> findMatchGoldenResourceCandidates(IAnyResource theTarget) {
|
||||||
List<MatchedGoldenResourceCandidate> retval = new ArrayList<>();
|
List<MatchedGoldenResourceCandidate> retval = new ArrayList<>();
|
||||||
|
|
||||||
BaseResourcePersistentId targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget);
|
BaseResourcePersistentId<?> targetPid = myIdHelperService.getPidOrNull(RequestPartitionId.allPartitions(), theTarget);
|
||||||
if (targetPid != null) {
|
if (targetPid != null) {
|
||||||
Optional<? extends IMdmLink> oLink = myMdmLinkDaoSvc.getMatchedLinkForSourcePid(targetPid);
|
Optional<? extends IMdmLink> oLink = myMdmLinkDaoSvc.getMatchedLinkForSourcePid(targetPid);
|
||||||
if (oLink.isPresent()) {
|
if (oLink.isPresent()) {
|
||||||
BaseResourcePersistentId goldenResourcePid = oLink.get().getGoldenResourcePersistenceId();
|
BaseResourcePersistentId<?> goldenResourcePid = oLink.get().getGoldenResourcePersistenceId();
|
||||||
ourLog.debug("Resource previously linked. Using existing link.");
|
ourLog.debug("Resource previously linked. Using existing link.");
|
||||||
retval.add(new MatchedGoldenResourceCandidate(goldenResourcePid, oLink.get()));
|
retval.add(new MatchedGoldenResourceCandidate(goldenResourcePid, oLink.get()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,20 +26,20 @@ import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId;
|
||||||
|
|
||||||
public class MatchedGoldenResourceCandidate {
|
public class MatchedGoldenResourceCandidate {
|
||||||
|
|
||||||
private final BaseResourcePersistentId myCandidateGoldenResourcePid;
|
private final BaseResourcePersistentId<?> myCandidateGoldenResourcePid;
|
||||||
private final MdmMatchOutcome myMdmMatchOutcome;
|
private final MdmMatchOutcome myMdmMatchOutcome;
|
||||||
|
|
||||||
public MatchedGoldenResourceCandidate(BaseResourcePersistentId theCandidate, MdmMatchOutcome theMdmMatchOutcome) {
|
public MatchedGoldenResourceCandidate(BaseResourcePersistentId<?> theCandidate, MdmMatchOutcome theMdmMatchOutcome) {
|
||||||
myCandidateGoldenResourcePid = theCandidate;
|
myCandidateGoldenResourcePid = theCandidate;
|
||||||
myMdmMatchOutcome = theMdmMatchOutcome;
|
myMdmMatchOutcome = theMdmMatchOutcome;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MatchedGoldenResourceCandidate(BaseResourcePersistentId theGoldenResourcePid, IMdmLink theMdmLink) {
|
public MatchedGoldenResourceCandidate(BaseResourcePersistentId<?> theGoldenResourcePid, IMdmLink theMdmLink) {
|
||||||
myCandidateGoldenResourcePid = theGoldenResourcePid;
|
myCandidateGoldenResourcePid = theGoldenResourcePid;
|
||||||
myMdmMatchOutcome = new MdmMatchOutcome(theMdmLink.getVector(), theMdmLink.getScore()).setMatchResultEnum(theMdmLink.getMatchResult());
|
myMdmMatchOutcome = new MdmMatchOutcome(theMdmLink.getVector(), theMdmLink.getScore()).setMatchResultEnum(theMdmLink.getMatchResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResourcePersistentId getCandidateGoldenResourcePid() {
|
public BaseResourcePersistentId<?> getCandidateGoldenResourcePid() {
|
||||||
return myCandidateGoldenResourcePid;
|
return myCandidateGoldenResourcePid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MdmCandidateSearchSvc {
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public Collection<IAnyResource> findCandidates(String theResourceType, IAnyResource theResource, RequestPartitionId theRequestPartitionId) {
|
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<MdmFilterSearchParamJson> filterSearchParams = myMdmSettings.getMdmRules().getCandidateFilterSearchParams();
|
||||||
List<String> filterCriteria = buildFilterQuery(filterSearchParams, theResourceType);
|
List<String> filterCriteria = buildFilterQuery(filterSearchParams, theResourceType);
|
||||||
List<MdmResourceSearchParamJson> candidateSearchParams = myMdmSettings.getMdmRules().getCandidateSearchParams();
|
List<MdmResourceSearchParamJson> candidateSearchParams = myMdmSettings.getMdmRules().getCandidateSearchParams();
|
||||||
|
@ -120,7 +120,7 @@ public class MdmCandidateSearchSvc {
|
||||||
* 4. Store all results in `theMatchedPidsToResources`
|
* 4. Store all results in `theMatchedPidsToResources`
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@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.
|
//1.
|
||||||
Optional<String> oResourceCriteria = myMdmCandidateSearchCriteriaBuilderSvc.buildResourceQueryString(theResourceType, theResource, theFilterCriteria, resourceSearchParam);
|
Optional<String> oResourceCriteria = myMdmCandidateSearchCriteriaBuilderSvc.buildResourceQueryString(theResourceType, theResource, theFilterCriteria, resourceSearchParam);
|
||||||
if (!oResourceCriteria.isPresent()) {
|
if (!oResourceCriteria.isPresent()) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MdmGoldenResourceFindingSvc {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAnyResource getGoldenResourceFromMatchedGoldenResourceCandidate(MatchedGoldenResourceCandidate theMatchedGoldenResourceCandidate, String theResourceType) {
|
public IAnyResource getGoldenResourceFromMatchedGoldenResourceCandidate(MatchedGoldenResourceCandidate theMatchedGoldenResourceCandidate, String theResourceType) {
|
||||||
BaseResourcePersistentId goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid();
|
BaseResourcePersistentId<?> goldenResourcePid = theMatchedGoldenResourceCandidate.getCandidateGoldenResourcePid();
|
||||||
return myMdmResourceDaoSvc.readGoldenResourceByPid(goldenResourcePid, theResourceType);
|
return myMdmResourceDaoSvc.readGoldenResourceByPid(goldenResourcePid, theResourceType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher<IAnyReso
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected BaseResourcePersistentId getMatchedResourcePidFromResource(IAnyResource theResource) {
|
protected BaseResourcePersistentId<?> getMatchedResourcePidFromResource(IAnyResource theResource) {
|
||||||
BaseResourcePersistentId retval;
|
BaseResourcePersistentId<?> retval;
|
||||||
|
|
||||||
boolean isGoldenRecord = MdmResourceUtil.isMdmManaged(theResource);
|
boolean isGoldenRecord = MdmResourceUtil.isMdmManaged(theResource);
|
||||||
if (isGoldenRecord) {
|
if (isGoldenRecord) {
|
||||||
|
@ -71,7 +71,7 @@ public abstract class BaseGoldenResourceMatcher extends TypeSafeMatcher<IAnyReso
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<? extends IMdmLink> getMdmLinksForTarget(IAnyResource theTargetResource, MdmMatchResultEnum theMatchResult) {
|
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);
|
List<? extends IMdmLink> matchLinkForTarget = myMdmLinkDaoSvc.getMdmLinksBySourcePidAndMatchResult(pidOrNull, theMatchResult);
|
||||||
if (!matchLinkForTarget.isEmpty()) {
|
if (!matchLinkForTarget.isEmpty()) {
|
||||||
return matchLinkForTarget;
|
return matchLinkForTarget;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import java.util.stream.Collectors;
|
||||||
public class IsLinkedTo extends BaseGoldenResourceMatcher {
|
public class IsLinkedTo extends BaseGoldenResourceMatcher {
|
||||||
|
|
||||||
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
|
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
|
||||||
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
|
private BaseResourcePersistentId<?> incomingResourceGoldenResourcePid;
|
||||||
|
|
||||||
protected IsLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
protected IsLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
||||||
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
||||||
|
|
|
@ -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.
|
* Matcher with tells us if there is an MdmLink with between these two resources that are considered POSSIBLE DUPLICATE.
|
||||||
* For use only on GoldenResource.
|
* For use only on GoldenResource.
|
||||||
*/
|
*/
|
||||||
private BaseResourcePersistentId incomingGoldenResourcePid;
|
private BaseResourcePersistentId<?> incomingGoldenResourcePid;
|
||||||
|
|
||||||
protected IsPossibleDuplicateOf(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
protected IsPossibleDuplicateOf(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
||||||
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
||||||
public class IsPossibleLinkedTo extends BaseGoldenResourceMatcher {
|
public class IsPossibleLinkedTo extends BaseGoldenResourceMatcher {
|
||||||
|
|
||||||
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
|
private List<BaseResourcePersistentId> baseResourceGoldenResourcePids;
|
||||||
private BaseResourcePersistentId incomingResourceGoldenResourcePid;
|
private BaseResourcePersistentId<?> incomingResourceGoldenResourcePid;
|
||||||
|
|
||||||
protected IsPossibleLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theTargetResources) {
|
protected IsPossibleLinkedTo(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theTargetResources) {
|
||||||
super(theIdHelperService, theMdmLinkDaoSvc, theTargetResources);
|
super(theIdHelperService, theMdmLinkDaoSvc, theTargetResources);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.stream.Collectors;
|
||||||
public class IsSameGoldenResourceAs extends BaseGoldenResourceMatcher {
|
public class IsSameGoldenResourceAs extends BaseGoldenResourceMatcher {
|
||||||
|
|
||||||
private List<BaseResourcePersistentId> goldenResourcePidsToMatch;
|
private List<BaseResourcePersistentId> goldenResourcePidsToMatch;
|
||||||
private BaseResourcePersistentId incomingGoldenResourcePid;
|
private BaseResourcePersistentId<?> incomingGoldenResourcePid;
|
||||||
|
|
||||||
public IsSameGoldenResourceAs(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
public IsSameGoldenResourceAs(IIdHelperService theIdHelperService, MdmLinkDaoSvc theMdmLinkDaoSvc, IAnyResource... theBaseResource) {
|
||||||
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
super(theIdHelperService, theMdmLinkDaoSvc, theBaseResource);
|
||||||
|
|
|
@ -768,7 +768,7 @@ public class ResourceTable extends BaseHasResource implements Serializable, IBas
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseResourcePersistentId getPersistentId() {
|
public BaseResourcePersistentId<?> getPersistentId() {
|
||||||
return new JpaPid(getId());
|
return new JpaPid(getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ResourcePersistentIdMap {
|
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) {
|
public static ResourcePersistentIdMap fromResourcePersistentIds(List<BaseResourcePersistentId> theResourcePersistentIds) {
|
||||||
ResourcePersistentIdMap retval = new ResourcePersistentIdMap();
|
ResourcePersistentIdMap retval = new ResourcePersistentIdMap();
|
||||||
|
@ -36,7 +36,7 @@ public class ResourcePersistentIdMap {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(BaseResourcePersistentId theResourcePersistentId) {
|
private void add(BaseResourcePersistentId<?> theResourcePersistentId) {
|
||||||
IIdType id = theResourcePersistentId.getAssociatedResourceId();
|
IIdType id = theResourcePersistentId.getAssociatedResourceId();
|
||||||
myMap.put(id.toUnqualifiedVersionless(), theResourcePersistentId);
|
myMap.put(id.toUnqualifiedVersionless(), theResourcePersistentId);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class ResourcePersistentIdMap {
|
||||||
return myMap.containsKey(theId.toUnqualifiedVersionless());
|
return myMap.containsKey(theId.toUnqualifiedVersionless());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResourcePersistentId getResourcePersistentId(IIdType theId) {
|
public BaseResourcePersistentId<?> getResourcePersistentId(IIdType theId) {
|
||||||
return myMap.get(theId.toUnqualifiedVersionless());
|
return myMap.get(theId.toUnqualifiedVersionless());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class ResourcePersistentIdMap {
|
||||||
return myMap.size();
|
return myMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void put(IIdType theId, BaseResourcePersistentId thePid) {
|
public void put(IIdType theId, BaseResourcePersistentId<?> thePid) {
|
||||||
myMap.put(theId, thePid);
|
myMap.put(theId, thePid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,7 +390,7 @@ public class SearchParamExtractorService {
|
||||||
}
|
}
|
||||||
|
|
||||||
IIdType referenceElement = thePathAndRef.getRef().getReferenceElement();
|
IIdType referenceElement = thePathAndRef.getRef().getReferenceElement();
|
||||||
BaseResourcePersistentId resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement);
|
BaseResourcePersistentId<?> resolvedTargetId = theTransactionDetails.getResolvedResourceId(referenceElement);
|
||||||
ResourceLink resourceLink;
|
ResourceLink resourceLink;
|
||||||
|
|
||||||
Long targetVersionId = nextId.getVersionIdPartAsLong();
|
Long targetVersionId = nextId.getVersionIdPartAsLong();
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc
|
||||||
ourLog.info("Triggering job[{}] delivering {} resources", theJobDetails.getJobId(), resourceIds.size());
|
ourLog.info("Triggering job[{}] delivering {} resources", theJobDetails.getJobId(), resourceIds.size());
|
||||||
int highestIndexSubmitted = theJobDetails.getCurrentSearchLastUploadedIndex();
|
int highestIndexSubmitted = theJobDetails.getCurrentSearchLastUploadedIndex();
|
||||||
|
|
||||||
for (BaseResourcePersistentId next : resourceIds) {
|
for (BaseResourcePersistentId<?> next : resourceIds) {
|
||||||
IBaseResource nextResource = resourceDao.readByPid(next);
|
IBaseResource nextResource = resourceDao.readByPid(next);
|
||||||
Future<Void> future = submitResource(theJobDetails.getSubscriptionId(), nextResource);
|
Future<Void> future = submitResource(theJobDetails.getSubscriptionId(), nextResource);
|
||||||
futures.add(Pair.of(nextResource.getIdElement().getIdPart(), future));
|
futures.add(Pair.of(nextResource.getIdElement().getIdPart(), future));
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class BaseSearchSvc {
|
||||||
return theInvocation -> {
|
return theInvocation -> {
|
||||||
List<JpaPid> pids = (List<JpaPid>) theInvocation.getArguments()[0];
|
List<JpaPid> pids = (List<JpaPid>) theInvocation.getArguments()[0];
|
||||||
List<IBaseResource> resources = (List<IBaseResource>) theInvocation.getArguments()[2];
|
List<IBaseResource> resources = (List<IBaseResource>) theInvocation.getArguments()[2];
|
||||||
for (BaseResourcePersistentId nextPid : pids) {
|
for (BaseResourcePersistentId<?> nextPid : pids) {
|
||||||
Patient pt = new Patient();
|
Patient pt = new Patient();
|
||||||
pt.setId(nextPid.toString());
|
pt.setId(nextPid.toString());
|
||||||
resources.add(pt);
|
resources.add(pt);
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class ResourceVersionSvcTest {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseResourcePersistentId first = resourcePersistentIds.remove(0);
|
BaseResourcePersistentId<?> first = resourcePersistentIds.remove(0);
|
||||||
if (resourcePersistentIds.isEmpty()) {
|
if (resourcePersistentIds.isEmpty()) {
|
||||||
when(myIdHelperService.resolveResourcePersistentIdsWithCache(any(), any())).thenReturn(Collections.singletonList(first));
|
when(myIdHelperService.resolveResourcePersistentIdsWithCache(any(), any())).thenReturn(Collections.singletonList(first));
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,7 +114,7 @@ public class ResourceVersionSvcTest {
|
||||||
IIdType type = new IdDt("Patient/RED");
|
IIdType type = new IdDt("Patient/RED");
|
||||||
JpaPid jpaPid = new JpaPid(1L);
|
JpaPid jpaPid = new JpaPid(1L);
|
||||||
jpaPid.setAssociatedResourceId(type);
|
jpaPid.setAssociatedResourceId(type);
|
||||||
HashMap<IIdType, BaseResourcePersistentId> map = new HashMap<>();
|
HashMap<IIdType, BaseResourcePersistentId<?>> map = new HashMap<>();
|
||||||
map.put(type, jpaPid);
|
map.put(type, jpaPid);
|
||||||
ResourceIdPackage pack = new ResourceIdPackage(type, jpaPid, 2L);
|
ResourceIdPackage pack = new ResourceIdPackage(type, jpaPid, 2L);
|
||||||
|
|
||||||
|
@ -197,11 +197,11 @@ public class ResourceVersionSvcTest {
|
||||||
// helper class to package up data for helper methods
|
// helper class to package up data for helper methods
|
||||||
private class ResourceIdPackage {
|
private class ResourceIdPackage {
|
||||||
public IIdType MyResourceId;
|
public IIdType MyResourceId;
|
||||||
public BaseResourcePersistentId MyPid;
|
public BaseResourcePersistentId<?> MyPid;
|
||||||
public Long MyVersion;
|
public Long MyVersion;
|
||||||
|
|
||||||
public ResourceIdPackage(IIdType id,
|
public ResourceIdPackage(IIdType id,
|
||||||
BaseResourcePersistentId pid,
|
BaseResourcePersistentId<?> pid,
|
||||||
Long version) {
|
Long version) {
|
||||||
MyResourceId = id;
|
MyResourceId = id;
|
||||||
MyPid = pid;
|
MyPid = pid;
|
||||||
|
|
|
@ -32,11 +32,11 @@ public interface IMdmLinkExpandSvc {
|
||||||
|
|
||||||
Set<String> expandMdmBySourceResourceId(IIdType theId);
|
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);
|
Set<String> expandMdmByGoldenResourceId(IdDt theId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,15 +37,15 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface IMdmLinkDao<T extends IMdmLink> {
|
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);
|
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);
|
List<T> findAllById(List<BaseResourcePersistentId> thePids);
|
||||||
|
|
||||||
Optional<T> findById(BaseResourcePersistentId thePid);
|
Optional<T> findById(BaseResourcePersistentId<?> thePid);
|
||||||
|
|
||||||
void deleteAll(List<T> theLinks);
|
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);
|
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);
|
void deleteLinksWithAnyReferenceToPids(List<BaseResourcePersistentId> theResourcePersistentIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MdmLinkDeleteSvc {
|
||||||
* @return the number of records deleted
|
* @return the number of records deleted
|
||||||
*/
|
*/
|
||||||
public int deleteWithAnyReferenceTo(IBaseResource theResource) {
|
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);
|
int removed = myMdmLinkDao.deleteWithAnyReferenceToPid(pid);
|
||||||
if (removed > 0) {
|
if (removed > 0) {
|
||||||
ourLog.info("Removed {} MDM links with references to {}", removed, theResource.getIdElement().toVersionless());
|
ourLog.info("Removed {} MDM links with references to {}", removed, theResource.getIdElement().toVersionless());
|
||||||
|
@ -56,7 +56,7 @@ public class MdmLinkDeleteSvc {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteNonRedirectWithAnyReferenceTo(IBaseResource theResource) {
|
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);
|
int removed = myMdmLinkDao.deleteWithAnyReferenceToPidAndMatchResultNot(pid, MdmMatchResultEnum.REDIRECT);
|
||||||
if (removed > 0) {
|
if (removed > 0) {
|
||||||
ourLog.info("Removed {} non-redirect MDM links with references to {}", removed, theResource.getIdElement().toVersionless());
|
ourLog.info("Removed {} non-redirect MDM links with references to {}", removed, theResource.getIdElement().toVersionless());
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc {
|
||||||
* @return A set of strings representing the FHIR ids of the expanded resources.
|
* @return A set of strings representing the FHIR ids of the expanded resources.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId theSourceResourcePid) {
|
public Set<String> expandMdmBySourceResourcePid(BaseResourcePersistentId<?> theSourceResourcePid) {
|
||||||
ourLog.debug("About to expand source resource with PID {}", theSourceResourcePid);
|
ourLog.debug("About to expand source resource with PID {}", theSourceResourcePid);
|
||||||
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsBySourcePidAndMatchResult(theSourceResourcePid, MdmMatchResultEnum.MATCH);
|
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsBySourcePidAndMatchResult(theSourceResourcePid, MdmMatchResultEnum.MATCH);
|
||||||
return flattenPidTuplesToSet(theSourceResourcePid, goldenPidSourcePidTuples);
|
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.
|
* @return A set of strings representing the FHIR ids of the expanded resources.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId theGoldenResourcePid) {
|
public Set<String> expandMdmByGoldenResourceId(BaseResourcePersistentId<?> theGoldenResourcePid) {
|
||||||
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
|
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
|
||||||
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH);
|
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH);
|
||||||
return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples);
|
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.
|
* @return A set of strings representing the FHIR ids of the expanded resources.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId theGoldenResourcePid) {
|
public Set<String> expandMdmByGoldenResourcePid(BaseResourcePersistentId<?> theGoldenResourcePid) {
|
||||||
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
|
ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid);
|
||||||
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH);
|
List<MdmPidTuple> goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH);
|
||||||
return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples);
|
return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples);
|
||||||
|
@ -126,12 +126,12 @@ public class MdmLinkExpandSvc implements IMdmLinkExpandSvc {
|
||||||
@Override
|
@Override
|
||||||
public Set<String> expandMdmByGoldenResourceId(IdDt theId) {
|
public Set<String> expandMdmByGoldenResourceId(IdDt theId) {
|
||||||
ourLog.debug("About to expand golden resource with golden resource id {}", 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);
|
return expandMdmByGoldenResourcePid(pidOrThrowException);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Set<String> flattenPidTuplesToSet(BaseResourcePersistentId initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
|
public Set<String> flattenPidTuplesToSet(BaseResourcePersistentId<?> initialPid, List<MdmPidTuple> goldenPidSourcePidTuples) {
|
||||||
Set<BaseResourcePersistentId> flattenedPids = new HashSet<>();
|
Set<BaseResourcePersistentId> flattenedPids = new HashSet<>();
|
||||||
goldenPidSourcePidTuples.forEach(tuple -> {
|
goldenPidSourcePidTuples.forEach(tuple -> {
|
||||||
flattenedPids.add(tuple.getSourcePid());
|
flattenedPids.add(tuple.getSourcePid());
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Objects;
|
||||||
* a Long, a String, or something else.
|
* a Long, a String, or something else.
|
||||||
*/
|
*/
|
||||||
public abstract class BaseResourcePersistentId<T> {
|
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 Long myVersion;
|
||||||
private final String myResourceType;
|
private final String myResourceType;
|
||||||
// TODO KHS can this be final?
|
// TODO KHS can this be final?
|
||||||
|
|
|
@ -54,12 +54,12 @@ import java.util.function.Supplier;
|
||||||
*/
|
*/
|
||||||
public class TransactionDetails {
|
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 final Date myTransactionDate;
|
||||||
private List<Runnable> myRollbackUndoActions = Collections.emptyList();
|
private List<Runnable> myRollbackUndoActions = Collections.emptyList();
|
||||||
private Map<String, BaseResourcePersistentId> myResolvedResourceIds = Collections.emptyMap();
|
private Map<String, BaseResourcePersistentId<?>> myResolvedResourceIds = Collections.emptyMap();
|
||||||
private Map<String, BaseResourcePersistentId> myResolvedMatchUrls = Collections.emptyMap();
|
private Map<String, BaseResourcePersistentId<?>> myResolvedMatchUrls = Collections.emptyMap();
|
||||||
private Map<String, Object> myUserData;
|
private Map<String, Object> myUserData;
|
||||||
private ListMultimap<Pointcut, HookParams> myDeferredInterceptorBroadcasts;
|
private ListMultimap<Pointcut, HookParams> myDeferredInterceptorBroadcasts;
|
||||||
private EnumSet<Pointcut> myDeferredInterceptorBroadcastPointcuts;
|
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.
|
* the TransactionDetails if they are known to exist and be valid targets for other resources to link to.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public BaseResourcePersistentId getResolvedResourceId(IIdType theId) {
|
public BaseResourcePersistentId<?> getResolvedResourceId(IIdType theId) {
|
||||||
String idValue = theId.toUnqualifiedVersionless().getValue();
|
String idValue = theId.toUnqualifiedVersionless().getValue();
|
||||||
return myResolvedResourceIds.get(idValue);
|
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
|
* "<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.
|
* 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;
|
assert theResourceId != null;
|
||||||
|
|
||||||
if (myResolvedResourceIds.isEmpty()) {
|
if (myResolvedResourceIds.isEmpty()) {
|
||||||
|
@ -150,7 +150,7 @@ public class TransactionDetails {
|
||||||
myResolvedResourceIds.put(theResourceId.toVersionless().getValue(), thePersistentId);
|
myResolvedResourceIds.put(theResourceId.toVersionless().getValue(), thePersistentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, BaseResourcePersistentId> getResolvedMatchUrls() {
|
public Map<String, BaseResourcePersistentId<?>> getResolvedMatchUrls() {
|
||||||
return myResolvedMatchUrls;
|
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
|
* "<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.
|
* 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.notBlank(theConditionalUrl);
|
||||||
Validate.notNull(thePersistentId);
|
Validate.notNull(thePersistentId);
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public class TransactionDetails {
|
||||||
myResolvedMatchUrls.put(theConditionalUrl, thePersistentId);
|
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) {
|
if (myResolvedMatchUrls.containsKey(theConditionalUrl) && myResolvedMatchUrls.get(theConditionalUrl) != NOT_FOUND) {
|
||||||
return myResolvedMatchUrls.get(theConditionalUrl).getId() != thePersistentId.getId();
|
return myResolvedMatchUrls.get(theConditionalUrl).getId() != thePersistentId.getId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,14 +80,14 @@ public class FetchResourceIdsStep implements IFirstJobStepWorker<BulkExportJobPa
|
||||||
|
|
||||||
// filters are the filters for searching
|
// filters are the filters for searching
|
||||||
ourLog.info("Running FetchResourceIdsStep for resource type: {} with params: {}", resourceType, providerParams);
|
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<>();
|
List<Id> idsToSubmit = new ArrayList<>();
|
||||||
|
|
||||||
if (!pidIterator.hasNext()) {
|
if (!pidIterator.hasNext()) {
|
||||||
ourLog.debug("Bulk Export generated an iterator with no results!");
|
ourLog.debug("Bulk Export generated an iterator with no results!");
|
||||||
}
|
}
|
||||||
while (pidIterator.hasNext()) {
|
while (pidIterator.hasNext()) {
|
||||||
BaseResourcePersistentId pid = pidIterator.next();
|
BaseResourcePersistentId<?> pid = pidIterator.next();
|
||||||
|
|
||||||
Id id;
|
Id id;
|
||||||
if (pid.getResourceType() != null) {
|
if (pid.getResourceType() != null) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class ConsumeFilesStep implements ILastJobStepWorker<BulkImportJobParamet
|
||||||
|
|
||||||
List<IIdType> idsList = new ArrayList<>(ids.keySet());
|
List<IIdType> idsList = new ArrayList<>(ids.keySet());
|
||||||
List<BaseResourcePersistentId> resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true);
|
List<BaseResourcePersistentId> resolvedIds = myIdHelperService.resolveResourcePersistentIdsWithCache(RequestPartitionId.allPartitions(), idsList, true);
|
||||||
for (BaseResourcePersistentId next : resolvedIds) {
|
for (BaseResourcePersistentId<?> next : resolvedIds) {
|
||||||
IIdType resId = next.getAssociatedResourceId();
|
IIdType resId = next.getAssociatedResourceId();
|
||||||
theTransactionDetails.addResolvedResourceId(resId, next);
|
theTransactionDetails.addResolvedResourceId(resId, next);
|
||||||
ids.remove(resId);
|
ids.remove(resId);
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class Id implements IModelJson {
|
||||||
return new HashCodeBuilder(17, 37).append(myResourceType).append(myId).toHashCode();
|
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 id = new Id();
|
||||||
id.setId(((JpaPid)thePID).getId().toString());
|
id.setId(((JpaPid)thePID).getId().toString());
|
||||||
id.setResourceType(theResourceType);
|
id.setResourceType(theResourceType);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ReindexStep implements IJobStepWorker<ReindexJobParameters, Resourc
|
||||||
@Autowired
|
@Autowired
|
||||||
private DaoRegistry myDaoRegistry;
|
private DaoRegistry myDaoRegistry;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IIdHelperService<BaseResourcePersistentId> myIdHelperService;
|
private IIdHelperService<BaseResourcePersistentId<?>> myIdHelperService;
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +103,7 @@ public class ReindexStep implements IJobStepWorker<ReindexJobParameters, Resourc
|
||||||
@Override
|
@Override
|
||||||
public Void doInTransaction(@Nonnull TransactionStatus theStatus) {
|
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);
|
ourLog.info("Starting reindex work chunk with {} resources - Instance[{}] Chunk[{}]", persistentIds.size(), myInstanceId, myChunkId);
|
||||||
StopWatch sw = new StopWatch();
|
StopWatch sw = new StopWatch();
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class FetchResourceIdsStepTest {
|
||||||
|
|
||||||
// verify all submitted ids are there
|
// verify all submitted ids are there
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (BaseResourcePersistentId pid : patientIds) {
|
for (BaseResourcePersistentId<?> pid : patientIds) {
|
||||||
Id id = Id.getIdFromPID(pid, "Patient");
|
Id id = Id.getIdFromPID(pid, "Patient");
|
||||||
for (ResourceIdList idList : listIds) {
|
for (ResourceIdList idList : listIds) {
|
||||||
found = idList.getIds().contains(id);
|
found = idList.getIds().contains(id);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class MdmInflateAndSubmitResourcesStep implements IJobStepWorker<MdmSubmi
|
||||||
|
|
||||||
private List<IBaseResource> fetchAllResources(List<? extends BaseResourcePersistentId> theIds) {
|
private List<IBaseResource> fetchAllResources(List<? extends BaseResourcePersistentId> theIds) {
|
||||||
List<IBaseResource> resources = new ArrayList<>();
|
List<IBaseResource> resources = new ArrayList<>();
|
||||||
for (BaseResourcePersistentId id : theIds) {
|
for (BaseResourcePersistentId<?> id : theIds) {
|
||||||
assert id.getResourceType() != null;
|
assert id.getResourceType() != null;
|
||||||
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(id.getResourceType());
|
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.
|
// 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.
|
||||||
|
|
|
@ -191,7 +191,7 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
|
||||||
* @throws ResourceNotFoundException If the ID is not known to the server
|
* @throws ResourceNotFoundException If the ID is not known to the server
|
||||||
* @throws ResourceGoneException If the resource has been deleted
|
* @throws ResourceGoneException If the resource has been deleted
|
||||||
*/
|
*/
|
||||||
T readByPid(BaseResourcePersistentId thePid);
|
T readByPid(BaseResourcePersistentId<?> thePid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a resource by its internal PID
|
* 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
|
* @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));
|
throw new UnsupportedOperationException(Msg.code(571));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,5 +343,5 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
|
||||||
*
|
*
|
||||||
* @param theResourcePersistentId The ID
|
* @param theResourcePersistentId The ID
|
||||||
*/
|
*/
|
||||||
void reindex(BaseResourcePersistentId theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
|
void reindex(BaseResourcePersistentId<?> theResourcePersistentId, RequestDetails theRequest, TransactionDetails theTransactionDetails);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class DaoMethodOutcome extends MethodOutcome {
|
||||||
private IBasePersistedResource myEntity;
|
private IBasePersistedResource myEntity;
|
||||||
private IBaseResource myPreviousResource;
|
private IBaseResource myPreviousResource;
|
||||||
private boolean myNop;
|
private boolean myNop;
|
||||||
private BaseResourcePersistentId myResourcePersistentId;
|
private BaseResourcePersistentId<?> myResourcePersistentId;
|
||||||
private RestOperationTypeEnum myOperationType;
|
private RestOperationTypeEnum myOperationType;
|
||||||
private String myMatchUrl;
|
private String myMatchUrl;
|
||||||
|
|
||||||
|
@ -104,11 +104,11 @@ public class DaoMethodOutcome extends MethodOutcome {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResourcePersistentId getPersistentId() {
|
public BaseResourcePersistentId<?> getPersistentId() {
|
||||||
return myResourcePersistentId;
|
return myResourcePersistentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DaoMethodOutcome setPersistentId(BaseResourcePersistentId theResourcePersistentId) {
|
public DaoMethodOutcome setPersistentId(BaseResourcePersistentId<?> theResourcePersistentId) {
|
||||||
myResourcePersistentId = theResourcePersistentId;
|
myResourcePersistentId = theResourcePersistentId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class LazyDaoMethodOutcome extends DaoMethodOutcome {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public LazyDaoMethodOutcome(BaseResourcePersistentId theResourcePersistentId) {
|
public LazyDaoMethodOutcome(BaseResourcePersistentId<?> theResourcePersistentId) {
|
||||||
setPersistentId(theResourcePersistentId);
|
setPersistentId(theResourcePersistentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ abstract public class BaseResourcePidList implements IResourcePidList {
|
||||||
return Collections.unmodifiableList(myIds);
|
return Collections.unmodifiableList(myIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResourcePersistentId getId(int theIndex) {
|
public BaseResourcePersistentId<?> getId(int theIndex) {
|
||||||
return myIds.get(theIndex);
|
return myIds.get(theIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,9 @@ import java.util.Objects;
|
||||||
|
|
||||||
public class TypedResourcePid {
|
public class TypedResourcePid {
|
||||||
public final String resourceType;
|
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.resourceType = theResourceType;
|
||||||
this.id = theId;
|
this.id = theId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Optional;
|
||||||
import java.util.Set;
|
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.
|
* and actual resource IDs.
|
||||||
*/
|
*/
|
||||||
public interface IIdHelperService<T extends BaseResourcePersistentId> {
|
public interface IIdHelperService<T extends BaseResourcePersistentId> {
|
||||||
|
|
|
@ -318,7 +318,7 @@ public abstract class BaseStorageDao {
|
||||||
return outcome;
|
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);
|
LazyDaoMethodOutcome outcome = new LazyDaoMethodOutcome(theResourcePersistentId);
|
||||||
|
|
||||||
outcome.setEntitySupplier(theEntity);
|
outcome.setEntitySupplier(theEntity);
|
||||||
|
|
|
@ -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());
|
String msg = getContext().getLocalizer().getMessageSanitized(BaseStorageDao.class, "transactionOperationWithMultipleMatchFailure", "PATCH", theConditionalUrl, match.size());
|
||||||
throw new PreconditionFailedException(Msg.code(972) + msg);
|
throw new PreconditionFailedException(Msg.code(972) + msg);
|
||||||
} else if (match.size() == 1) {
|
} else if (match.size() == 1) {
|
||||||
BaseResourcePersistentId pid = match.iterator().next();
|
BaseResourcePersistentId<?> pid = match.iterator().next();
|
||||||
entityToUpdate = readEntityLatestVersion(pid, theRequestDetails, theTransactionDetails);
|
entityToUpdate = readEntityLatestVersion(pid, theRequestDetails, theTransactionDetails);
|
||||||
resourceId = entityToUpdate.getIdDt();
|
resourceId = entityToUpdate.getIdDt();
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,7 +140,7 @@ public abstract class BaseStorageResourceDao<T extends IBaseResource> extends Ba
|
||||||
@Nonnull
|
@Nonnull
|
||||||
protected abstract String getResourceName();
|
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);
|
protected abstract IBasePersistedResource readEntityLatestVersion(IIdType theId, RequestDetails theRequestDetails, TransactionDetails theTransactionDetails);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
public class SearchBuilderFactory<T extends BaseResourcePersistentId<?>> {
|
public class SearchBuilderFactory<T extends BaseResourcePersistentId> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext myApplicationContext;
|
private ApplicationContext myApplicationContext;
|
||||||
|
|
|
@ -48,12 +48,12 @@ public class ExpungeOperation implements Callable<ExpungeOutcome> {
|
||||||
private DaoConfig myDaoConfig;
|
private DaoConfig myDaoConfig;
|
||||||
|
|
||||||
private final String myResourceName;
|
private final String myResourceName;
|
||||||
private final BaseResourcePersistentId myResourceId;
|
private final BaseResourcePersistentId<?> myResourceId;
|
||||||
private final ExpungeOptions myExpungeOptions;
|
private final ExpungeOptions myExpungeOptions;
|
||||||
private final RequestDetails myRequestDetails;
|
private final RequestDetails myRequestDetails;
|
||||||
private final AtomicInteger myRemainingCount;
|
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;
|
myResourceName = theResourceName;
|
||||||
myResourceId = theResourceId;
|
myResourceId = theResourceId;
|
||||||
myExpungeOptions = theExpungeOptions;
|
myExpungeOptions = theExpungeOptions;
|
||||||
|
|
|
@ -43,11 +43,11 @@ public class ExpungeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext myApplicationContext;
|
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);
|
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);
|
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);
|
ExpungeOperation expungeOperation = getExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequest);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class ExpungeService {
|
||||||
return expungeOperation.call();
|
return expungeOperation.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteAllSearchParams(BaseResourcePersistentId theResourceId) {
|
public void deleteAllSearchParams(BaseResourcePersistentId<?> theResourceId) {
|
||||||
myExpungeDaoService.deleteAllSearchParams(theResourceId);
|
myExpungeDaoService.deleteAllSearchParams(theResourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class DaoResourceLinkResolver<T extends BaseResourcePersistentId> impleme
|
||||||
valueOf = placeholderResourceDao.create(newResource, theRequest).getEntity();
|
valueOf = placeholderResourceDao.create(newResource, theRequest).getEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseResourcePersistentId persistentId = valueOf.getPersistentId();
|
BaseResourcePersistentId<?> persistentId = valueOf.getPersistentId();
|
||||||
persistentId = myIdHelperService.newPid(persistentId.getId());
|
persistentId = myIdHelperService.newPid(persistentId.getId());
|
||||||
persistentId.setAssociatedResourceId(valueOf.getIdDt());
|
persistentId.setAssociatedResourceId(valueOf.getIdDt());
|
||||||
theTransactionDetails.addResolvedResourceId(persistentId.getAssociatedResourceId(), persistentId);
|
theTransactionDetails.addResolvedResourceId(persistentId.getAssociatedResourceId(), persistentId);
|
||||||
|
|
Loading…
Reference in New Issue