Interface OrcidSynchronizationService

All Known Implementing Classes:
OrcidSynchronizationServiceImpl

public interface OrcidSynchronizationService
Service that handle the the synchronization between a DSpace profile and the relative ORCID profile, if any.
Author:
Luca Giamminonni (luca.giamminonni at 4science.it)
  • Method Details

    • isLinkedToOrcid

      boolean isLinkedToOrcid(Context context, Item item)
      Check if the given item is linked to an ORCID profile.
      Parameters:
      context - the relevant DSpace Context.
      item - the item to check
      Returns:
      true if the given item is linked to ORCID
    • linkProfile

      void linkProfile(Context context, Item profile, OrcidTokenResponseDTO token) throws SQLException
      Configure the given profile with the data present in the given ORCID token. This action is required to synchronize profile and related entities with ORCID. No security check is done, it is therefore the caller's responsibility to verify for example that the current user has permission to connect the profile to ORCID (if necessary).
      Parameters:
      context - the relevant DSpace Context.
      profile - the profile to configure
      token - the ORCID token
      Throws:
      SQLException - if a SQL error occurs during the profile update
    • unlinkProfile

      void unlinkProfile(Context context, Item profile) throws SQLException
      Disconnect the given profile from ORCID.
      Parameters:
      context - the relevant DSpace Context.
      profile - the profile to disconnect
      Throws:
      SQLException - if a SQL error occurs during the profile update
    • setEntityPreference

      boolean setEntityPreference(Context context, Item profile, OrcidEntityType entityType, OrcidEntitySyncPreference value) throws SQLException
      Set the synchronization preference for the given profile related to the given ORCID entity type.
      Parameters:
      context - the relevant DSpace Context.
      profile - the researcher profile to update
      entityType - the orcid entity type
      value - the new synchronization preference value
      Returns:
      true if the value has actually been updated, false if the value to be set is the same as the one already configured
      Throws:
      SQLException - if a SQL error occurs during the profile update
      IllegalArgumentException - if the given researcher profile is no linked with an ORCID account
    • setProfilePreference

      boolean setProfilePreference(Context context, Item profile, List<OrcidProfileSyncPreference> values) throws SQLException
      Update the profile's synchronization preference for the given profile.
      Parameters:
      context - the relevant DSpace Context.
      profile - the researcher profile to update
      values - the new synchronization preference values
      Returns:
      true if the value has actually been updated, false if the value to be set is the same as the one already configured
      Throws:
      SQLException - if a SQL error occurs during the profile update
      IllegalArgumentException - if the given researcher profile is no linked with an ORCID account
    • setSynchronizationMode

      boolean setSynchronizationMode(Context context, Item profile, OrcidSynchronizationMode value) throws SQLException
      Set the ORCID synchronization mode for the given profile.
      Parameters:
      context - the relevant DSpace Context.
      profile - the researcher profile to update
      value - the new synchronization mode value
      Returns:
      true if the value has actually been updated, false if the value to be set is the same as the one already configured
      Throws:
      SQLException - if a SQL error occurs during the profile update
    • isSynchronizationAllowed

      boolean isSynchronizationAllowed(Item profile, Item item)
      Check if the given researcher profile item is configured to synchronize the given item with ORCID.
      Parameters:
      profile - the researcher profile item
      item - the entity type to check
      Returns:
      true if the given entity type can be synchronize with ORCID, false otherwise
    • getSynchronizationMode

      Optional<OrcidSynchronizationMode> getSynchronizationMode(Item profile)
      Returns the ORCID synchronization mode configured for the given profile item.
      Parameters:
      profile - the researcher profile item
      Returns:
      the synchronization mode
    • getEntityPreference

      Optional<OrcidEntitySyncPreference> getEntityPreference(Item profile, OrcidEntityType entityType)
      Returns the ORCID synchronization preference related to the given entity type configured for the given profile item.
      Parameters:
      profile - the researcher profile item
      entityType - the orcid entity type
      Returns:
      the configured preference
    • getProfilePreferences

      List<OrcidProfileSyncPreference> getProfilePreferences(Item profile)
      Returns the ORCID synchronization preferences related to the profile itself configured for the given profile item.
      Parameters:
      profile - the researcher profile item
      Returns:
      the synchronization mode
    • getDisconnectionMode

      OrcidProfileDisconnectionMode getDisconnectionMode()
      Returns the configuration ORCID profile's disconnection mode. If that mode is not configured or the configuration is wrong, the value DISABLED is returned.
      Returns:
      the disconnection mode
    • findProfilesByOrcid

      List<Item> findProfilesByOrcid(Context context, String orcid)
      Returns all the profiles with the given orcid id.
      Parameters:
      context - the relevant DSpace Context.
      orcid - the orcid id to search for
      Returns:
      the found profile items