Package ca.uhn.fhir.jpa.mdm.dao
Class MdmLinkDaoSvc<P extends ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId,M extends ca.uhn.fhir.mdm.api.IMdmLink<P>>
java.lang.Object
ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc<P,M>
public class MdmLinkDaoSvc<P extends ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId,M extends ca.uhn.fhir.mdm.api.IMdmLink<P>>
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOrUpdateLinkEntity(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource, ca.uhn.fhir.mdm.api.MdmMatchOutcome theMatchOutcome, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, ca.uhn.fhir.mdm.model.MdmTransactionContext theMdmTransactionContext) voiddeleteLink(M theMdmLink) Delete a givenIMdmLink.voiddeleteLinksWithAnyReferenceToPids(List<P> theGoldenResourcePids) org.springframework.data.domain.Page<M>executeTypedQuery(ca.uhn.fhir.mdm.api.MdmQuerySearchParameters theMdmQuerySearchParameters) Given a list of criteria, return all links from the database which fits the criteria providedfindMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) findMdmLinkHistory(ca.uhn.fhir.mdm.api.MdmHistorySearchParameters theMdmHistorySearchParameters) findMdmLinkHistory(M mdmLink) Deprecated, for removal: This API element is subject to removal in a future version.findMdmLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource) Given a Golden Resource, return all links in which they are the source Golden Resource of theIMdmLinkfindMdmLinksBySourceResource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given a sourceIBaseResource, return allIMdmLinkentities in which this source is the source of the relationship.findMdmMatchLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource) Finds allIMdmLinkentities in which theGoldenResource's PID is the source of the relationship.getLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) getLinkByGoldenResourcePidAndSourceResourcePid(Long theGoldenResourcePid, Long theSourceResourcePid) Deprecated.This was deprecated in favour of using ResourcePersistenceId rather than longsgetLinkByGoldenResourcePidAndSourceResourcePid(P theGoldenResourcePid, P theSourceResourcePid) Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if existsgetMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given an IBaseResource, return its MatchedIMdmLink.getMatchedLinkForSourcePid(P theSourcePid) Deprecated.getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource) getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(Long theGoldenResourcePid, Long theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Given a golden resource a source and a match result, return the matchingIMdmLink, if it exists.getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(P theGoldenResourcePid, P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) getMdmLinksBySourcePidAndMatchResult(P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Given a source resource Pid, and a match result, return all links that match these criteria.getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) Get allIMdmLinkwhich haveMdmMatchResultEnum.POSSIBLE_DUPLICATEas their match result.getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) ca.uhn.fhir.mdm.api.IMdmLinkFactory delegation method, whenever you need a new MdmLink, use this factory method.Persist an MDM link to the database.
-
Constructor Details
-
MdmLinkDaoSvc
public MdmLinkDaoSvc()
-
-
Method Details
-
createOrUpdateLinkEntity
@Transactional public M createOrUpdateLinkEntity(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource, ca.uhn.fhir.mdm.api.MdmMatchOutcome theMatchOutcome, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, @Nullable ca.uhn.fhir.mdm.model.MdmTransactionContext theMdmTransactionContext) -
getOrCreateMdmLinkByGoldenResourceAndSourceResource
@Nonnull public M getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) -
getLinkByGoldenResourcePidAndSourceResourcePid
@Deprecated public Optional<M> getLinkByGoldenResourcePidAndSourceResourcePid(Long theGoldenResourcePid, Long theSourceResourcePid) Deprecated.This was deprecated in favour of using ResourcePersistenceId rather than longsGiven a golden resource Pid and source Pid, return the mdm link that matches these criterias if exists- Parameters:
theGoldenResourcePid-theSourceResourcePid-- Returns:
-
getLinkByGoldenResourcePidAndSourceResourcePid
public Optional<M> getLinkByGoldenResourcePidAndSourceResourcePid(P theGoldenResourcePid, P theSourceResourcePid) Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if exists- Parameters:
theGoldenResourcePid- The ResourcePersistenceId of the golden resourcetheSourceResourcePid- The ResourcepersistenceId of the Source resource- Returns:
- The
IMdmLinkentity that matches these criteria if exists
-
getMdmLinksBySourcePidAndMatchResult
public List<M> getMdmLinksBySourcePidAndMatchResult(P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Given a source resource Pid, and a match result, return all links that match these criteria.- Parameters:
theSourcePid- the source of the relationship.theMatchResult- the Match Result of the relationship- Returns:
- a list of
IMdmLinkentities matching these criteria.
-
getMatchedLinkForSourcePid
Deprecated.Given a source Pid, return its MatchedIMdmLink. There can only ever be at most one of these, but its possible the source has no matches, and may return an empty optional.- Parameters:
theSourcePid- The Pid of the source you wish to find the matching link for.- Returns:
- the
IMdmLinkthat contains the Match information for the source.
-
getMatchedLinkForSource
public Optional<M> getMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given an IBaseResource, return its MatchedIMdmLink. There can only ever be at most one of these, but its possible the source has no matches, and may return an empty optional.- Parameters:
theSourceResource- The IBaseResource representing the source you wish to find the matching link for.- Returns:
- the
IMdmLinkthat contains the Match information for the source.
-
getPossibleMatchedLinkForSource
public Optional<M> getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) -
getMdmLinksByGoldenResourcePidSourcePidAndMatchResult
public Optional<M> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(Long theGoldenResourcePid, Long theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Given a golden resource a source and a match result, return the matchingIMdmLink, if it exists.- Parameters:
theGoldenResourcePid- The Pid of the Golden Resource in the relationshiptheSourcePid- The Pid of the source in the relationshiptheMatchResult- The MatchResult you are looking for.- Returns:
- an Optional
IMdmLinkcontaining the matched link if it exists.
-
getMdmLinksByGoldenResourcePidSourcePidAndMatchResult
public Optional<M> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(P theGoldenResourcePid, P theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) -
getPossibleDuplicates
Get allIMdmLinkwhich haveMdmMatchResultEnum.POSSIBLE_DUPLICATEas their match result.- Returns:
- A list of
IMdmLinkthat hold potential duplicate golden resources.
-
findMdmLinkBySource
@Transactional public Optional<M> findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) -
deleteLink
Delete a givenIMdmLink. Note that this does not clear out the Golden resource. It is a simple entity delete.- Parameters:
theMdmLink- theIMdmLinkto delete.
-
findMdmLinksByGoldenResource
@Transactional public List<M> findMdmLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource) Given a Golden Resource, return all links in which they are the source Golden Resource of theIMdmLink- Parameters:
theGoldenResource- TheIBaseResourceGolden Resource who's links you would like to retrieve.- Returns:
- A list of all
IMdmLinkentities in which theGoldenResource is the source Golden Resource
-
save
Persist an MDM link to the database.- Parameters:
theMdmLink- the link to save.- Returns:
- the persisted
IMdmLinkentity.
-
executeTypedQuery
public org.springframework.data.domain.Page<M> executeTypedQuery(ca.uhn.fhir.mdm.api.MdmQuerySearchParameters theMdmQuerySearchParameters) Given a list of criteria, return all links from the database which fits the criteria provided- Parameters:
theMdmQuerySearchParameters- TheMdmQuerySearchParametersbeing searched.- Returns:
- a list of
IMdmLinkentities which match the example.
-
findMdmLinksBySourceResource
@Transactional public List<M> findMdmLinksBySourceResource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given a sourceIBaseResource, return allIMdmLinkentities in which this source is the source of the relationship. This will show you all links for a given Patient/Practitioner.- Parameters:
theSourceResource- the source resource to find links for.- Returns:
- all links for the source.
-
findMdmMatchLinksByGoldenResource
public List<M> findMdmMatchLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource) Finds allIMdmLinkentities in which theGoldenResource's PID is the source of the relationship.- Parameters:
theGoldenResource- the source resource to find links for.- Returns:
- all links for the source.
-
newMdmLink
Factory delegation method, whenever you need a new MdmLink, use this factory method. //TODO Should we make the constructor private for MdmLink? or work out some way to ensure they can only be instantiated via factory.- Returns:
- A new
IMdmLink.
-
getMatchedOrPossibleMatchedLinkForSource
public Optional<M> getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource) -
getLinkByGoldenResourceAndSourceResource
public Optional<M> getLinkByGoldenResourceAndSourceResource(@Nullable org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, @Nullable org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) -
deleteLinksWithAnyReferenceToPids
@Transactional(propagation=MANDATORY) public void deleteLinksWithAnyReferenceToPids(List<P> theGoldenResourcePids) -
findMdmLinkHistory
@Deprecated(since="6.5.7", forRemoval=true) public org.springframework.data.history.Revisions<Long,M> findMdmLinkHistory(M mdmLink) Deprecated, for removal: This API element is subject to removal in a future version. -
findMdmLinkHistory
@Transactional public List<ca.uhn.fhir.mdm.api.MdmLinkWithRevision<M>> findMdmLinkHistory(ca.uhn.fhir.mdm.api.MdmHistorySearchParameters theMdmHistorySearchParameters)
-