Package ca.uhn.fhir.jpa.mdm.dao
Class MdmLinkDaoSvc
java.lang.Object
ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionca.uhn.fhir.mdm.api.IMdmLinkcreateOrUpdateLinkEntity(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(ca.uhn.fhir.mdm.api.IMdmLink theMdmLink) Delete a givenIMdmLink.voiddeleteLinksWithAnyReferenceToPids(List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> theGoldenResourcePids) org.springframework.data.domain.Page<? extends ca.uhn.fhir.mdm.api.IMdmLink>executeTypedQuery(org.hl7.fhir.instance.model.api.IIdType theGoldenResourceId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, ca.uhn.fhir.mdm.api.paging.MdmPageRequest thePageRequest, List<Integer> thePartitionId) Given a list of criteria, return all links from the database which fits the criteria providedOptional<? extends ca.uhn.fhir.mdm.api.IMdmLink>findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) List<? extends ca.uhn.fhir.mdm.api.IMdmLink>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 theIMdmLinkList<? extends ca.uhn.fhir.mdm.api.IMdmLink>findMdmLinksBySourceResource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given a sourceIBaseResource, return allIMdmLinkentities in which this source is the source of the relationship.List<? extends ca.uhn.fhir.mdm.api.IMdmLink>findMdmMatchLinksByGoldenResource(org.hl7.fhir.instance.model.api.IBaseResource theGoldenResource) Finds allIMdmLinkentities in which theGoldenResource's PID is the source of the relationship.Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getLinkByGoldenResourcePidAndSourceResourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourceResourcePid) Given a golden resource Pid and source Pid, return the mdm link that matches these criterias if existsOptional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getLinkByGoldenResourcePidAndSourceResourcePid(Long theGoldenResourcePid, Long theSourceResourcePid) Deprecated.This was deprecated in favour of using ResourcePersistenceId rather than longsOptional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) Given an IBaseResource, return its MatchedIMdmLink.Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getMatchedLinkForSourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid) Deprecated.Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource) Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>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.List<? extends ca.uhn.fhir.mdm.api.IMdmLink>getMdmLinksBySourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult) Given a source resource Pid, and a match result, return all links that match these criteria.ca.uhn.fhir.mdm.api.IMdmLinkgetOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) List<? extends ca.uhn.fhir.mdm.api.IMdmLink>Get allIMdmLinkwhich haveMdmMatchResultEnum.POSSIBLE_DUPLICATEas their match result.Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink>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.ca.uhn.fhir.mdm.api.IMdmLinksave(ca.uhn.fhir.mdm.api.IMdmLink theMdmLink) Persist an MDM link to the database.
-
Constructor Details
-
MdmLinkDaoSvc
public MdmLinkDaoSvc()
-
-
Method Details
-
createOrUpdateLinkEntity
@Transactional public ca.uhn.fhir.mdm.api.IMdmLink 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 ca.uhn.fhir.mdm.api.IMdmLink getOrCreateMdmLinkByGoldenResourceAndSourceResource(org.hl7.fhir.instance.model.api.IAnyResource theGoldenResource, org.hl7.fhir.instance.model.api.IAnyResource theSourceResource) -
getLinkByGoldenResourcePidAndSourceResourcePid
@Deprecated public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getLinkByGoldenResourcePidAndSourceResourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMdmLinksBySourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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 @Transactional public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMatchedLinkForSourcePid(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theSourcePid) 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) -
getMdmLinksByGoldenResourcePidSourcePidAndMatchResult
public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMdmLinksByGoldenResourcePidSourcePidAndMatchResult(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theGoldenResourcePid, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> findMdmLinkBySource(org.hl7.fhir.instance.model.api.IBaseResource theSourceResource) -
deleteLink
@Transactional(propagation=REQUIRES_NEW) public void deleteLink(ca.uhn.fhir.mdm.api.IMdmLink theMdmLink) 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> executeTypedQuery(org.hl7.fhir.instance.model.api.IIdType theGoldenResourceId, org.hl7.fhir.instance.model.api.IIdType theSourceId, ca.uhn.fhir.mdm.api.MdmMatchResultEnum theMatchResult, ca.uhn.fhir.mdm.api.MdmLinkSourceEnum theLinkSource, ca.uhn.fhir.mdm.api.paging.MdmPageRequest thePageRequest, List<Integer> thePartitionId) Given a list of criteria, return all links from the database which fits the criteria provided- Parameters:
theGoldenResourceId- The resource ID of the golden resource being searched.theSourceId- The resource ID of the source resource being searched.theMatchResult- theMdmMatchResultEnumbeing searched.theLinkSource- theMdmLinkSourceEnumbeing searched.thePageRequest- theMdmPageRequestpaging informationthePartitionId- List of partitions ID being searched, where the link's partition must be in the list.- Returns:
- a list of
IMdmLinkentities which match the example.
-
findMdmLinksBySourceResource
@Transactional public List<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<? extends ca.uhn.fhir.mdm.api.IMdmLink> getMatchedOrPossibleMatchedLinkForSource(org.hl7.fhir.instance.model.api.IAnyResource theResource) -
getLinkByGoldenResourceAndSourceResource
public Optional<? extends ca.uhn.fhir.mdm.api.IMdmLink> 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<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> theGoldenResourcePids)
-