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 static 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()
Given the list of providers, the method scans through the list to find all profile resource, and merge them together in order to develop a list of resource specific canonical URLs.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 registryvoid
register(FHIRRegistryResourceProvider provider)
Add a registry resource provider to the registry
-
-
-
Method Detail
-
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
-
register
public void register(FHIRRegistryResourceProvider provider)
Add a registry resource provider to the registry- Parameters:
provider
- the registry resource provider to be added
-
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
-
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
-
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
-
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
-
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
-
-