Class DOIServiceImpl

java.lang.Object
org.dspace.identifier.DOIServiceImpl
All Implemented Interfaces:
DOIService

public class DOIServiceImpl extends Object implements DOIService
Service implementation for the DOI object. This class is responsible for all business logic calls for the DOI object and is autowired by Spring. This class should never be accessed directly.
Author:
kevinvandevelde at atmire.com
  • Field Details

  • Constructor Details

    • DOIServiceImpl

      protected DOIServiceImpl()
  • Method Details

    • update

      public void update(Context context, DOI doi) throws SQLException
      Description copied from interface: DOIService
      Update a DOI in storage.
      Specified by:
      update in interface DOIService
      Parameters:
      context - current DSpace session.
      doi - the DOI to persist.
      Throws:
      SQLException - passed through.
    • create

      public DOI create(Context context) throws SQLException
      Description copied from interface: DOIService
      Create a new DOI in storage.
      Specified by:
      create in interface DOIService
      Parameters:
      context - current DSpace session.
      Returns:
      the new DOI.
      Throws:
      SQLException - passed through.
    • delete

      public void delete(Context context, DOI doi) throws SQLException
      Description copied from interface: DOIService
      Deletes the given DOI.
      Specified by:
      delete in interface DOIService
      Parameters:
      context - current DSpace session.
      Throws:
      SQLException - passed through.
    • findAll

      public List<DOI> findAll(Context context) throws SQLException
      Description copied from interface: DOIService
      Retrieves the full list of DOIs currently in storage.
      Specified by:
      findAll in interface DOIService
      Parameters:
      context - current DSpace session.
      Returns:
      The list of all DOIs currently in storage.
      Throws:
      SQLException - passed through.
    • findByDoi

      public DOI findByDoi(Context context, String doi) throws SQLException
      Description copied from interface: DOIService
      Find a specific DOI in storage.
      Specified by:
      findByDoi in interface DOIService
      Parameters:
      context - current DSpace session.
      doi - string representation of the DOI.
      Returns:
      the DOI object found.
      Throws:
      SQLException - passed through, can mean none found.
    • findDOIByDSpaceObject

      public DOI findDOIByDSpaceObject(Context context, DSpaceObject dso) throws SQLException
      Description copied from interface: DOIService
      Find the DOI assigned to a given DSpace Object.
      Specified by:
      findDOIByDSpaceObject in interface DOIService
      Parameters:
      context - current DSpace session.
      dso - The DSpace Object.
      Returns:
      the DSO's DOI.
      Throws:
      SQLException - passed through.
    • findDOIByDSpaceObject

      public DOI findDOIByDSpaceObject(Context context, DSpaceObject dso, List<Integer> statusToExclude) throws SQLException
      Description copied from interface: DOIService
      Find the DOI assigned to a given DSpace Object, unless it has one of a given set of statuses.
      Specified by:
      findDOIByDSpaceObject in interface DOIService
      Parameters:
      context - current DSpace context.
      dso - the DSpace Object.
      statusToExclude - uninteresting statuses.
      Returns:
      the DSO's DOI.
      Throws:
      SQLException - passed through.
    • DOIToExternalForm

      public String DOIToExternalForm(String identifier) throws IdentifierException
      Description copied from interface: DOIService
      This method helps to convert a DOI into a URL. It takes DOIs in one of the following formats and returns it as URL (f.e. http://dx.doi.org/10.123/456). Allowed formats are:
      • doi:10.123/456
      • 10.123/456
      • http://dx.doi.org/10.123/456
      Specified by:
      DOIToExternalForm in interface DOIService
      Parameters:
      identifier - A DOI that should be returned in external form.
      Returns:
      A String containing a URL to the official DOI resolver.
      Throws:
      IdentifierException - If identifier could not be recognized as valid DOI.
    • DOIFromExternalFormat

      public String DOIFromExternalFormat(String identifier) throws DOIIdentifierException
      Description copied from interface: DOIService
      Convert an HTTP DOI URL (https://doi.org/10.something) to a "doi:" URI.
      Specified by:
      DOIFromExternalFormat in interface DOIService
      Parameters:
      identifier - HTTP URL
      Returns:
      DOI URI
      Throws:
      DOIIdentifierException - if identifier is not recognizable.
    • formatIdentifier

      public String formatIdentifier(String identifier) throws DOIIdentifierException
      Description copied from interface: DOIService
      Recognize format of DOI and return it with leading doi-Scheme.
      Specified by:
      formatIdentifier in interface DOIService
      Parameters:
      identifier - Identifier to format, following format are accepted: f.e. 10.123/456, doi:10.123/456, http://dx.doi.org/10.123/456.
      Returns:
      Given Identifier with DOI-Scheme, f.e. doi:10.123/456.
      Throws:
      DOIIdentifierException - If DOI could not be recognized.
    • getDOIsByStatus

      public List<DOI> getDOIsByStatus(Context context, List<Integer> statuses) throws SQLException
      Description copied from interface: DOIService
      Find all DOIs that have one of a given set of statuses.
      Specified by:
      getDOIsByStatus in interface DOIService
      Parameters:
      context - current DSpace session.
      statuses - desired statuses.
      Returns:
      all DOIs having any of the given statuses.
      Throws:
      SQLException - passed through.
    • getSimilarDOIsNotInState

      public List<DOI> getSimilarDOIsNotInState(Context context, String doiPattern, List<Integer> statuses, boolean dsoIsNotNull) throws SQLException
      Description copied from interface: DOIService
      Find all DOIs that are similar to the specified pattern and not in the specified states.
      Specified by:
      getSimilarDOIsNotInState in interface DOIService
      Parameters:
      context - DSpace context
      doiPattern - The pattern, e.g. "10.5072/123.%"
      statuses - The statuses the DOI should not be in, @{link DOIIdentifierProvider.DELETED}.
      dsoIsNotNull - Boolean whether all DOIs should be excluded where the DSpaceObject is NULL.
      Returns:
      null or a list of DOIs
      Throws:
      SQLException - if database error
    • getResolver

      public String getResolver()
      Description copied from interface: DOIService
      Get the URL stem of the DOI resolver, e.g. "https://doi.org/".
      Specified by:
      getResolver in interface DOIService
      Returns:
      URL to the DOI resolver.