Package com.ibm.fhir.registry
Class FHIRRegistry
- java.lang.Object
-
- com.ibm.fhir.registry.FHIRRegistry
-
public final class FHIRRegistry extends Object
A singleton registry for FHIR definitional resources: http://hl7.org/fhir/definition.html
-
-
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 registrystatic FHIRRegistry
getInstance()
Get the singleton instance of this classString
getLatestVersion(String url, Class<? extends Resource> resourceType)
Get the latest version of a resource for the given url and resource typeMap<String,Set<Canonical>>
getProfiles()
Get a map containing sets of type specific canonical URLs for all profile resources across all providers.Collection<Canonical>
getProfiles(String type)
Get the profiles that constrain the given resource type as a collection ofCanonical
URLs<T extends Resource>
TgetResource(String url, Class<T> resourceType)
Get the resource for the given canonical url and resource type<T extends Resource>
Collection<T>getResources(Class<T> resourceType)
Get the resources for the given resource typeCollection<SearchParameter>
getSearchParameters(String type)
Get the search parameters with the given search parameter type (e.g.boolean
hasResource(String url, Class<? extends Resource> resourceType)
Indicates whether a resource for the given canonical url and resource type exists in the registry
-
-
-
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 urlresourceType
- 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 ofCanonical
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 urlresourceType
- 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 typeIllegalArgumentException
- if the resource type is not a definitional resource type
-
getResources
public <T extends Resource> Collection<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 urlresourceType
- 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 classThis 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
-
-