Class SearchUtil


  • public class SearchUtil
    extends Object
    Search Utility
    This class uses FHIRPath Expressions (and currently does not support XPath) and uses init to activate the Parameters/Compartments/ValueTypes components.
    • Method Detail

      • init

        public static void init()
        Initializes the various services related to Search and pre-caches.
        Loads the class in the classloader to initialize static members. Call this before using the class in order to avoid a slight performance hit on first use.
      • getUserDefinedSearchParameters

        protected static List<SearchParameter> getUserDefinedSearchParameters​(String resourceType)
                                                                       throws Exception
        Retrieves user-defined SearchParameters associated with the specified resource type and current tenant id.
        Parameters:
        resourceType - the resource type for which user-defined SearchParameters will be returned
        Returns:
        a list of user-defined SearchParameters associated with the specified resource type
        Throws:
        Exception
      • getFilteredBuiltinSearchParameters

        protected static List<SearchParameter> getFilteredBuiltinSearchParameters​(String resourceType)
                                                                           throws Exception
        Returns a filtered list of built-in SearchParameters associated with the specified resource type and those associated with the "Resource" resource type.
        Parameters:
        resourceType - the resource type
        Returns:
        a filtered list of SearchParameters
        Throws:
        Exception
      • getSearchParameter

        public static SearchParameter getSearchParameter​(Class<?> resourceType,
                                                         String name)
                                                  throws Exception
        Parameters:
        resourceType -
        code -
        Returns:
        the SearchParameter for type resourceType with code code or null if it doesn't exist
        Throws:
        Exception
      • getSearchParameter

        public static SearchParameter getSearchParameter​(String resourceType,
                                                         String code)
                                                  throws Exception
        Parameters:
        resourceType -
        code -
        Returns:
        the SearchParameter for type resourceType with code code or null if it doesn't exist
        Throws:
        Exception
      • getSearchParameter

        public static SearchParameter getSearchParameter​(Class<?> resourceType,
                                                         Canonical uri)
                                                  throws Exception
        Parameters:
        resourceType -
        uri -
        Returns:
        the SearchParameter for type resourceType with url uri or null if it doesn't exist
        Throws:
        Exception
      • getSearchParameter

        public static SearchParameter getSearchParameter​(String resourceType,
                                                         Canonical uri)
                                                  throws Exception
        Parameters:
        resourceType -
        uri -
        Returns:
        the SearchParameter for type resourceType with url uri or null if it doesn't exist
        Throws:
        Exception
      • getApplicableSearchParameters

        public static List<SearchParameter> getApplicableSearchParameters​(String resourceType)
                                                                   throws Exception
        Returns a list of SearchParameters that consist of those associated with the "Resource" base resource type, as well as those associated with the specified resource type.
        Throws:
        Exception
      • isSearchResultParameter

        public static boolean isSearchResultParameter​(String name)
      • isGeneralParameter

        public static boolean isGeneralParameter​(String name)
      • isChainedParameter

        public static boolean isChainedParameter​(String name)
      • parseChainedInclusionCriteria

        public static QueryParameter parseChainedInclusionCriteria​(QueryParameter inclusionCriteriaParm)
        Transforms the passed QueryParameter representing chained inclusion criteria, into an actual chain of QueryParameter objects. This method consumes QueryParameters with names of this form:
         "{attribute1}.{attribute2}:{resourceType}"
         
        For specific examples of chained inclusion criteria, see the FHIR spec for the Patient compartment
        Parameters:
        inclusionCriteriaParm -
        Returns:
        QueryParameter - The root of a parameter chain for chained inclusion criteria.
      • normalizeForSearch

        public static String normalizeForSearch​(String value)
        Normalizes a string to be used as a search parameter value. All accents and diacritics are removed. And then the string is transformed to lower case.
        Parameters:
        value -
        Returns:
      • getSummaryTextElementNames

        public static Set<String> getSummaryTextElementNames​(Class<?> resourceType)
        Return only the "text" element, the 'id' element, the 'meta' element, and only top-level mandatory elements. The id, meta and the top-level mandatory elements will be added by the ElementFilter automatically.
        Parameters:
        resourceType -
        Returns: