Interface IIdHelperService


public interface IIdHelperService
This interface is used to translate between ResourcePersistentId and actual resource IDs.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addResolvedPidToForcedId(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theResourcePersistentId, ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, String theForcedId, Date theDeletedAt)
    Pre-cache a PID-to-Resource-ID mapping for later retrieval by translatePidsToForcedIds(Set) and related methods
    boolean
    Returns true if the given resource ID should be stored in a forced ID.
    resolveResourceIdentity(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, String theResourceId)
    Given a forced ID, convert it to it's Long value.
    ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId
    resolveResourcePersistentIds(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, String theId)
    Given a resource type and ID, determines the internal persistent ID for the resource.
    Map<String,ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId>
    resolveResourcePersistentIds(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, List<String> theIds)
    Returns a mapping of Id -> ResourcePersistentId.
    List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId>
    resolveResourcePersistentIdsWithCache(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, List<org.hl7.fhir.instance.model.api.IIdType> theIds)
    Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs.
    List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId>
    resolveResourcePersistentIdsWithCache(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, List<org.hl7.fhir.instance.model.api.IIdType> theIds, boolean theOnlyForcedIds)
    Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs.
    org.hl7.fhir.instance.model.api.IIdType
    translatePidIdToForcedId(ca.uhn.fhir.context.FhirContext theCtx, String theResourceType, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theId)
    Given a persistent ID, returns the associated resource ID
    translatePidIdToForcedIdWithCache(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theResourcePersistentId)
     
     
  • Method Details

    • resolveResourcePersistentIdsWithCache

      @Nonnull List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> resolveResourcePersistentIdsWithCache(@Nonnull ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, List<org.hl7.fhir.instance.model.api.IIdType> theIds, boolean theOnlyForcedIds)
      Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs.

      This implementation will always try to use a cache for performance, meaning that it can resolve resources that are deleted (but note that forced IDs can't change, so the cache can't return incorrect results)

      Parameters:
      theOnlyForcedIds - If true, resources which are not existing forced IDs will not be resolved
    • resolveResourcePersistentIds

      @Nonnull ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId resolveResourcePersistentIds(@Nonnull ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, String theId)
      Given a resource type and ID, determines the internal persistent ID for the resource.
      Throws:
      ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException - If the ID can not be found
    • resolveResourcePersistentIds

      @Nonnull Map<String,ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> resolveResourcePersistentIds(@Nonnull ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, List<String> theIds)
      Returns a mapping of Id -> ResourcePersistentId. If any resource is not found, it will throw ResourceNotFound exception (and no map will be returned)
    • translatePidIdToForcedId

      @Nonnull org.hl7.fhir.instance.model.api.IIdType translatePidIdToForcedId(ca.uhn.fhir.context.FhirContext theCtx, String theResourceType, ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theId)
      Given a persistent ID, returns the associated resource ID
    • resolveResourceIdentity

      @Nonnull IResourceLookup resolveResourceIdentity(@Nonnull ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, String theResourceId) throws ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException
      Given a forced ID, convert it to it's Long value. Since you are allowed to use string IDs for resources, we need to convert those to the underlying Long values that are stored, for lookup and comparison purposes.
      Throws:
      ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException - If the ID can not be found
    • idRequiresForcedId

      boolean idRequiresForcedId(String theId)
      Returns true if the given resource ID should be stored in a forced ID. Under default config (meaning client ID strategy is DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC) this will return true if the ID has any non-digit characters.

      In DaoConfig.ClientIdStrategyEnum.ANY mode it will always return true.

    • resolveResourcePersistentIdsWithCache

      @Nonnull List<ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId> resolveResourcePersistentIdsWithCache(ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, List<org.hl7.fhir.instance.model.api.IIdType> theIds)
      Given a collection of resource IDs (resource type + id), resolves the internal persistent IDs.

      This implementation will always try to use a cache for performance, meaning that it can resolve resources that are deleted (but note that forced IDs can't change, so the cache can't return incorrect results)

    • translatePidIdToForcedIdWithCache

      Optional<String> translatePidIdToForcedIdWithCache(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theResourcePersistentId)
    • translatePidsToForcedIds

    • addResolvedPidToForcedId

      void addResolvedPidToForcedId(ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId theResourcePersistentId, @Nonnull ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId, String theResourceType, @Nullable String theForcedId, @Nullable Date theDeletedAt)
      Pre-cache a PID-to-Resource-ID mapping for later retrieval by translatePidsToForcedIds(Set) and related methods