Class FHIRRegistry

    • Method Detail

      • addProvider

        public void addProvider​(FHIRRegistryResourceProvider provider)
        Add a registry resource provider to the registry
        Parameters:
        provider - the registry resource provider to be added
      • getLatestVersion

        public String getLatestVersion​(String url,
                                       Class<? extends Resource> resourceType)
        Get the latest version of a resource for the given url and resource type
        Parameters:
        url - the url
        resourceType - the resource type
        Returns:
        the latest version of a resource for the given url and resource type if exists, null otherwise
      • getProfiles

        public Map<String,​Set<Canonical>> getProfiles()
        Get a map containing sets of type specific canonical URLs for all profile resources across all providers.
        Returns:
        the map of sets
      • getProfiles

        public Collection<Canonical> getProfiles​(String type)
        Get the profiles that constrain the given resource type as a collection of Canonical URLs
        Parameters:
        type - the constrained resource type
        Returns:
        the profiles that constrain the given type as a collection of Canonical URLs
      • getResource

        public <T extends Resource> T getResource​(String url,
                                                  Class<T> resourceType)
        Get the resource for the given canonical url and resource type
        Parameters:
        url - the canonical url
        resourceType - the resource type
        Returns:
        the resource for the given canonical url and resource type if exists, null otherwise
        Throws:
        ClassCastException - if the resource exists in the registry but its type does not match given resource type
        IllegalArgumentException - if the resource type is not a definitional resource type
      • getResources

        public <T extends ResourceCollection<T> getResources​(Class<T> resourceType)
        Get the resources for the given resource type
        Parameters:
        resourceType - the resource type
        Returns:
        the resources for the given resource type
        Throws:
        IllegalArgumentException - if the resource type is not a definitional resource type
      • getSearchParameters

        public Collection<SearchParameter> getSearchParameters​(String type)
        Get the search parameters with the given search parameter type (e.g. string, token, etc.)

        The method getResources(Class) can be used to get all search parameters regardless of type

        Parameters:
        type - the search parameter type
        Returns:
        the search parameters with the given search parameter type
      • hasResource

        public boolean hasResource​(String url,
                                   Class<? extends Resource> resourceType)
        Indicates whether a resource for the given canonical url and resource type exists in the registry
        Parameters:
        url - the canonical url
        resourceType - the resource type
        Returns:
        true if a resource for the given canonical url and resource type exists in the registry, false otherwise
      • getInstance

        public static FHIRRegistry getInstance()
        Get the singleton instance of this class

        This first time that this method is called, all registry resource providers made available through the service loader are added to the registry

        Returns:
        the singleton instance of this class