
Package ca.uhn.fhir.jpa.cache
Interface IResourceIdentifierCacheSvc
- All Known Implementing Classes:
ResourceIdentifierCacheSvcImpl
public interface IResourceIdentifierCacheSvc
This service manages a partition-independent cache of resource identifiers.
- Since:
- 8.6.0
-
Method Summary
Modifier and TypeMethodDescriptiongetFhirIdAssociatedWithUniquePatientIdentifier
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId, String theSystem, String theValue, Supplier<String> theNewIdSupplier) Retrieves the FHIR ID associated with the given Patient identifier, creating a new record using the given Supplier if no existing record is found.long
getOrCreateResourceIdentifierSystem
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId, String theSystem) Retrieves (and creates if necessary) the PID associated with the given identifier system URL.
-
Method Details
-
getOrCreateResourceIdentifierSystem
long getOrCreateResourceIdentifierSystem(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId, String theSystem) Retrieves (and creates if necessary) the PID associated with the given identifier system URL.Thread-safety: This method is designed to be thread-safe, including in cases where multiple threads are attempting to create a new FHIR ID for the same identifier system. It will internally retry automatically if multiple threads attempt to create a new identifier system and will not fail in this case.
Transactionality: This method will open a new transaction if one is not already open.
- Parameters:
theRequestDetails
- The request details associated with the current requesttheRequestPartitionId
- The partition ID associated with the current requesttheSystem
- TheIdentifier.system
value- Returns:
- Returns a PID associated with the given identifier system URL.
-
getFhirIdAssociatedWithUniquePatientIdentifier
@Nonnull String getFhirIdAssociatedWithUniquePatientIdentifier(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, RequestPartitionId theRequestPartitionId, String theSystem, String theValue, Supplier<String> theNewIdSupplier) Retrieves the FHIR ID associated with the given Patient identifier, creating a new record using the given Supplier if no existing record is found. This method enforces uniqueness on the identifier using a database constraint and will therefore only allow one FHIR ID to be associated with one Identifier. No uniqueness is enforced on the FHIR ID.Thread safety: This method will fail with a constraint error if multiple threads attempt to assign a FHIR ID for the same system+value combination concurrently.
Transactionality: This method will open a new transaction if one is not already open.
- Parameters:
theSystem
- TheIdentifier.system
valuetheValue
- TheIdentifier.value
valuetheNewIdSupplier
- If no existing FHIR ID is found, a new entry will be created using this ID supplier- Returns:
- The FHIR ID associated with this identifier
-