Class AbstractUriMapper

java.lang.Object
org.openehealth.ipf.commons.ihe.fhir.translation.AbstractUriMapper
All Implemented Interfaces:
UriMapper
Direct Known Subclasses:
DefaultUriMapper, NamingSystemUriMapper

public abstract class AbstractUriMapper extends Object implements UriMapper
URI mapper base implementation that recognizes and creates OID URNs
Since:
3.1
Author:
Christian Ohr
  • Constructor Details

    • AbstractUriMapper

      public AbstractUriMapper()
  • Method Details

    • uriToOid

      public Optional<String> uriToOid(String uri)
      Description copied from interface: UriMapper
      Translates an URI into an OID. If the URI is an (OID) URN, the namespace-specific part should, be used as the OID.
      Specified by:
      uriToOid in interface UriMapper
      Parameters:
      uri - the URI
      Returns:
      the mapped OID
    • uriToNamespace

      public Optional<String> uriToNamespace(String uri)
      Description copied from interface: UriMapper
      Translates an URI into a Namespace.
      Specified by:
      uriToNamespace in interface UriMapper
      Parameters:
      uri - the URI
      Returns:
      the mapped namespace
    • oidToUri

      public String oidToUri(String oid)
      Description copied from interface: UriMapper
      Translates an OID into an URI. Instead of a real mapping, an URN can be derived from the OID (i.e. urn:oid:1.2.3.4), but in general the inverse mapping to UriMapper.uriToOid(String) should be applied.
      Specified by:
      oidToUri in interface UriMapper
      Parameters:
      oid - the OID
      Returns:
      the mapped URI
    • namespaceToUri

      public String namespaceToUri(String namespace)
      Description copied from interface: UriMapper
      Translates an Namespace into an URI. Instead of a real mapping, an URN can be derived from the namespace (i.e. urn:pin:namespace), but in general the inverse mapping to UriMapper.uriToNamespace(String) (String)} should be applied.
      Specified by:
      namespaceToUri in interface UriMapper
      Parameters:
      namespace - the namespace
      Returns:
      the mapped URI
    • mapUriToOid

      protected abstract Optional<String> mapUriToOid(String uri)
      Translate a non-URN URI (e.g. a URL) into an OID
      Parameters:
      uri - URI
      Returns:
      OID string
    • mapUriToNamespace

      protected abstract Optional<String> mapUriToNamespace(String uri)
      Translate a non-URN URI (e.g. a URL) into an OID
      Parameters:
      uri - URI
      Returns:
      OID string
    • mapOidToUri

      protected abstract Optional<String> mapOidToUri(String oid)
      Translate a OID into an URI. Can either return null or throw an exception if no URL was found.
      Parameters:
      oid - OID
      Returns:
      valid URI or null if no URI was found
    • mapNamespaceToUri

      protected abstract Optional<String> mapNamespaceToUri(String namespace)
      Translate a namespace into an URI. Can either return null or throw an exception if no URL was found.
      Parameters:
      namespace - namespace
      Returns:
      valid URI or null if no URI was found