Class MCRDNBURNRestClient

java.lang.Object
org.mycore.pi.urn.rest.MCRDNBURNRestClient

public class MCRDNBURNRestClient extends Object

Class for registering and updating urn managed by the DNB.

Author:
Huu Chi Vu, shermann
See Also:
  • Constructor Details

    • MCRDNBURNRestClient

      public MCRDNBURNRestClient(Function<MCRPIRegistrationInfo,MCRURNJsonBundle> bundleProvider)
      Creates a new operator with the given configuration.
      Parameters:
      bundleProvider -
    • MCRDNBURNRestClient

      public MCRDNBURNRestClient(Function<MCRPIRegistrationInfo,MCRURNJsonBundle> bundleProvider, Optional<org.apache.http.auth.UsernamePasswordCredentials> credentials)
      Parameters:
      bundleProvider - the provider creating the required json
      credentials - the credentials needed for authentication
  • Method Details

    • getBaseServiceURL

      @Deprecated protected String getBaseServiceURL(MCRPIRegistrationInfo urn)
      Deprecated.
      Returns the base url of the urn registration service.
    • getBaseServiceURL

      protected String getBaseServiceURL()
      Returns the base url of the urn registration service.
      Returns:
      the base url as set in mycore property MCR.PI.URNGranular.API.BaseURL
    • getBaseServiceCheckExistsURL

      protected String getBaseServiceCheckExistsURL(MCRPIRegistrationInfo urn)
      Returns the base url for checking the existence of a given urn.
      Parameters:
      urn - the MCRPIRegistrationInfo to test
      Returns:
      the request url
    • getUpdateURL

      protected String getUpdateURL(MCRPIRegistrationInfo urn)
      Returns the url for updating the urls assigned to a given urn.
      Parameters:
      urn - the urn
      Returns:
      the url for updating the urls
    • register

      public Optional<Date> register(MCRPIRegistrationInfo urn)

      Please see list of status codes and their meaning:

      204 No Content: URN is in database. No further information asked.

      301 Moved Permanently: The given URN is replaced with a newer version. This newer version should be used instead.

      404 Not Found: The given URN is not registered in system.

      410 Gone: The given URN is registered in system but marked inactive.

      Returns:
      the registration/update date