Class NihmsPassClientService

java.lang.Object
org.eclipse.pass.loader.nihms.client.NihmsPassClientService

@Service public class NihmsPassClientService extends Object
NIHMS PASS client service deals with interactions with the data via the PASS client and controls local data caches
Author:
Karen Hanson
  • Field Details

  • Constructor Details

    • NihmsPassClientService

      public NihmsPassClientService(PassClient passClient)
      Constructor that allows a PassClient to be passed in
      Parameters:
      passClient - the PassClient used to persist data
  • Method Details

    • clearCache

      public void clearCache()
      Remove all data from cache
    • findMostRecentGrantByAwardNumber

      public Grant findMostRecentGrantByAwardNumber(String awardNumber) throws IOException
      Searches for Grant record using awardNumber. Tries this first using the awardNumber as passed in, then again without spaces.
      Parameters:
      awardNumber - the award number
      Returns:
      the grant, or null if not found
      Throws:
      IOException - if there is an error reading the grant from the PassClient
    • findPublicationByPmid

      public Publication findPublicationByPmid(String pmid) throws IOException
      Looks up publication using PMID, since this is the most reliable field to match. Checks publication cache first, then checks index
      Parameters:
      pmid - the pub med id
      Returns:
      the publication, or null if it can't be found
      Throws:
      IOException - if there is an error reading the publication from the PassClient
    • findPublicationByDoi

      public Publication findPublicationByDoi(String doi, String pmid) throws IOException
      Looks up publication using DOI, call should include pmid so that it can check publication cache first, then checks index for DOI
      Parameters:
      doi - the digital object identifier
      pmid - the pub med id
      Returns:
      the publication, or null if it can't be found
      Throws:
      IOException - if there is an error reading the publication from the PassClient
    • findNihmsRepositoryCopyForPubId

      public RepositoryCopy findNihmsRepositoryCopyForPubId(String pubId) throws IOException
      Find NIHMS RepositoryCopy record for a publicationId
      Parameters:
      pubId - the publication id
      Returns:
      the repository copy, or null if it can't be found
      Throws:
      IOException - if there is an error reading the repository copy
    • findSubmissionsByPublicationAndUserId

      public List<Submission> findSubmissionsByPublicationAndUserId(String pubId, String userId) throws IOException
      Searches for Submissions matching a specific publication and User Id (Submission.submitter)
      Parameters:
      pubId - the publication id
      userId - the user id
      Returns:
      the submissions, may be empty but never null
      Throws:
      IOException - if there is an error reading the submissions
    • findJournalByIssn

      public String findJournalByIssn(String issn) throws IOException
      Look up Journal ID using ISSN
      Parameters:
      issn - the issn
      Returns:
      the journal ID for the ISSN, may be null if not found
      Throws:
      IOException - if there is an error reading the journal
    • findNihmsDepositForSubmission

      public Deposit findNihmsDepositForSubmission(String submissionId) throws IOException
      Searches for a NIHMS Deposit that matches a SubmissionID
      Parameters:
      submissionId - the submission id
      Returns:
      the deposit associated with the submission, may be null if not found
      Throws:
      IOException - if there is an error reading the deposit
    • findNihmsDepositbyNihmsId

      public Deposit findNihmsDepositbyNihmsId(String nihmsId) throws IOException
      Searches for a Deposit to NIHMS that matches a NihmsID
      Parameters:
      nihmsId - the NihmsId
      Returns:
      the deposit associated with the submission with the submission and submission publication properties inflated, may be null if not found
      Throws:
      IOException - if there is an error reading the deposit
    • findNihmsSubmissionsByPublicationId

      public List<Submission> findNihmsSubmissionsByPublicationId(String publicationId) throws IOException
      Find all Submissions with a publication that are associated with the NIHMS repository
      Throws:
      IOException
    • readGrant

      public Grant readGrant(String grantId) throws IOException
      Retrieve full grant record from database
      Parameters:
      grantId - the grant id
      Returns:
      Grant if found, or null if not found
      Throws:
      IOException - if there is an error reading the grant
    • readPublication

      public Publication readPublication(String publicationId) throws IOException
      Retrieve full publication record from database
      Parameters:
      publicationId - the publication id
      Returns:
      Publication if found, or null if not found
      Throws:
      IOException - if there is an error reading the publication
    • readSubmission

      public Submission readSubmission(String submissionId) throws IOException
      Retrieve full Submission record
      Parameters:
      submissionId - the submission id
      Returns:
      matching submission or null if none found
      Throws:
      IOException - if there is an error reading the submission
    • readDeposit

      public Deposit readDeposit(String depositId) throws IOException
      Retrieve full deposit record from database
      Parameters:
      depositId - the deposit id
      Returns:
      the deposit, or null if not found
      Throws:
      IOException - if there is an error reading the deposit
    • readRepository

      public Repository readRepository(String repositoryId) throws IOException
      Retrieve repository record from database
      Parameters:
      repositoryId - the repository id
      Returns:
      the deposit, or null if not found
      Throws:
      IOException - if there is an error reading the Repository
    • createPublication

      public String createPublication(Publication publication) throws IOException
      Parameters:
      publication - the publication
      Returns:
      the uri of the created publication
      Throws:
      IOException - if there is an error creating the publication
    • createSubmission

      public String createSubmission(Submission submission) throws IOException
      Parameters:
      submission - the submission
      Returns:
      the entity ID of the created submission
      Throws:
      IOException - if there is an error creating the submission
    • createRepositoryCopy

      public String createRepositoryCopy(RepositoryCopy repositoryCopy) throws IOException
      Create a new RepositoryCopy in PASS
      Parameters:
      repositoryCopy - the repository copy
      Returns:
      the entity ID of the created repository copy
      Throws:
      IOException - if unable to create repository copy
    • updatePublication

      public boolean updatePublication(Publication publication) throws IOException
      Update Publication in PASS
      Parameters:
      publication - the publication
      Returns:
      true if record needed to be updated, false if no update
      Throws:
      IOException - if unable to update publication
    • updateSubmission

      public boolean updateSubmission(Submission submission) throws IOException
      Update Submission in PASS
      Parameters:
      submission - the submission
      Returns:
      true if record needed to be updated, false if no update
      Throws:
      IOException - if unable to update submission
    • updateRepositoryCopy

      public boolean updateRepositoryCopy(RepositoryCopy repositoryCopy) throws IOException
      Update RepositoryCopy in PASS
      Parameters:
      repositoryCopy - the repository copy
      Returns:
      true if record needed to be updated, false if no update
      Throws:
      IOException - if unable to update repository copy
    • updateDeposit

      public boolean updateDeposit(Deposit deposit) throws IOException
      Update Deposit in PASS
      Parameters:
      deposit - the deposit
      Returns:
      true if record needed to be updated, false if no update
      Throws:
      IOException - if unable to update deposit