Class FHIRRegistry

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addProvider​(FHIRRegistryResourceProvider provider)
      Add a registry resource provider to the registry
      java.lang.String getDefaultVersion​(java.lang.String url, java.lang.Class<? extends Resource> resourceType)
      Get the default (or latest) version of a resource with the given url and resource type
      static FHIRRegistry getInstance()
      Get the singleton instance of this class
      java.util.Map<java.lang.String,​java.util.Set<Canonical>> getProfiles()
      Get a map containing sets of type specific canonical URLs for all profile resources across all providers.
      java.util.Collection<Canonical> getProfiles​(java.lang.String type)
      Get the profiles that constrain the given resource type as a collection of Canonical URLs
      java.util.Collection<FHIRRegistryResource> getRegistryResources​(java.lang.Class<? extends Resource> resourceType)
      Get the registry resources for the given resource type
      <T extends Resource>
      T
      getResource​(java.lang.String url, java.lang.Class<T> resourceType)
      Get the resource for the given canonical url and resource type
      <T extends Resource>
      T
      getResource​(java.lang.String url, java.lang.Class<T> resourceType, java.lang.String providerNameToExclude)
      Get the resource for the given canonical url and resource type
      <T extends Resource>
      java.util.Collection<T>
      getResources​(java.lang.Class<T> resourceType)
      Get the resources for the given resource type
      java.util.Collection<SearchParameter> getSearchParameters​(java.lang.String type)
      Get the search parameters with the given search parameter type (e.g.
      boolean hasResource​(java.lang.String url, java.lang.Class<? extends Resource> resourceType)
      Indicates whether a resource for the given canonical url and resource type exists in the registry
      static void init()
      initializes the Resource Providers.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • getDefaultVersion

        public java.lang.String getDefaultVersion​(java.lang.String url,
                                                  java.lang.Class<? extends Resource> resourceType)
        Get the default (or latest) version of a resource with the given url and resource type
        Parameters:
        url - the url
        resourceType - the resource type
        Returns:
        the default (or latest) version of a resource with the given url and resource type if exists, null otherwise
      • getProfiles

        public java.util.Map<java.lang.String,​java.util.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 java.util.Collection<Canonical> getProfiles​(java.lang.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​(java.lang.String url,
                                                  java.lang.Class<T> resourceType)
        Get the resource for the given canonical url and resource type
        Parameters:
        url - the canonical url (with optional version postfix and optional fragment id for contained resources)
        resourceType - the resource type
        Returns:
        the resource for the given canonical url and resource type if exists, null otherwise
        Throws:
        java.lang.ClassCastException - if the resource exists in the registry but its type does not match given resource type
        java.lang.IllegalArgumentException - if the resource type is not a definitional resource type
      • getResource

        public <T extends Resource> T getResource​(java.lang.String url,
                                                  java.lang.Class<T> resourceType,
                                                  java.lang.String providerNameToExclude)
        Get the resource for the given canonical url and resource type
        Parameters:
        url - the canonical url (with optional version postfix)
        resourceType - the resource type
        providerNameToExclude - the canonical class name of the provider that is to be excluded
        Returns:
        the resource for the given canonical url and resource type if exists, null otherwise
        Throws:
        java.lang.ClassCastException - if the resource exists in the registry but its type does not match given resource type
        java.lang.IllegalArgumentException - if the resource type is not a definitional resource type
      • getResources

        public <T extends Resource> java.util.Collection<T> getResources​(java.lang.Class<T> resourceType)
        Get the resources for the given resource type

        Use this method to get actual FHIR resources and not FHIR registry resources (metadata)

        Parameters:
        resourceType - the resource type
        Returns:
        the resources for the given resource type
        Throws:
        java.lang.IllegalArgumentException - if the resource type is not a definitional resource type
      • getRegistryResources

        public java.util.Collection<FHIRRegistryResource> getRegistryResources​(java.lang.Class<? extends Resource> resourceType)
        Get the registry resources for the given resource type

        Use this method to get FHIR registry resources (metadata) and not actual FHIR resources

        Parameters:
        resourceType - the resource type
        Returns:
        the registry resources for the given resource type
        Throws:
        java.lang.IllegalArgumentException - if the resource type is not a definitional resource type
      • getSearchParameters

        public java.util.Collection<SearchParameter> getSearchParameters​(java.lang.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​(java.lang.String url,
                                   java.lang.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
      • init

        public static void init()
        initializes the Resource Providers.
      • 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