Class ParameterNamesCache


  • public class ParameterNamesCache
    extends Object
    This class provides a static cache for FHIR Search Parameter names.
    • Constructor Detail

      • ParameterNamesCache

        public ParameterNamesCache()
    • Method Detail

      • getParameterNameId

        public static Integer getParameterNameId​(String parameterName)
        Retrieves the id for the name contained in the passed Parameter, for the current tenant-datastore. If not found, null is returned.
        Parameters:
        parameterName - A valid FHIR search parameter name.
        Returns:
        Integer The id corresponding to the parameter name.
        Throws:
        FHIRPersistenceDataAccessException
        FHIRPersistenceDBConnectException
      • putParameterNameId

        public static void putParameterNameId​(String tenantDatastoreCacheName,
                                              String parameterName,
                                              Integer parameterId)
        Adds the passed parameter name and id to the current tenant-datastore cache.
        Parameters:
        tenantDatastoreCacheName - The name of the datastore-specific cache the entry should be added to.
        parameterName - A valid search parameter name.
        parameterId - The id associated with the passed parameter name.
      • putParameterNameIds

        public static void putParameterNameIds​(String tenantDatastoreCacheName,
                                               Map<String,​Integer> newParameters)
        Adds the passed search parameter name/id pairs to the the current tenant-datastore cache.
        Parameters:
        tenantDatastoreCacheName - The name of the datastore-specific cache the entry should be added to.
        newParameters - A Map containing parameter name/id pairs.
      • getCacheNameForTenantDatastore

        public static String getCacheNameForTenantDatastore()
        Returns a String containing a combination of the current tenantId and datastoreId.
        Returns:
      • dumpCacheContents

        public static String dumpCacheContents()
        Returns:
        String - A formatted representation of the entire cache managed by this class.
      • reportCacheDiscrepancies

        public static String reportCacheDiscrepancies​(ParameterDAO dao)
        Determines and reports any discrepancies between the current thread's Parameter Names cache and the contents of the database PARAMETER_NAMES table.
        Parameters:
        dao - A Parameter DAO instance
        Returns:
        String - A report detailing cache/db discrepancies.
      • isEnabled

        public static boolean isEnabled()
      • setEnabled

        public static void setEnabled​(boolean newEnabled)