Package org.dspace.orcid.service
Interface OrcidSynchronizationService
-
- All Known Implementing Classes:
OrcidSynchronizationServiceImpl
public interface OrcidSynchronizationServiceService that handle the the syncronization between a DSpace profile and the relative ORCID profile, if any.- Author:
- Luca Giamminonni (luca.giamminonni at 4science.it)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Item>findProfilesByOrcid(Context context, String orcid)Returns all the profiles with the given orcid id.OrcidProfileDisconnectionModegetDisconnectionMode()Returns the configuration ORCID profile's disconnection mode.Optional<OrcidEntitySyncPreference>getEntityPreference(Item profile, OrcidEntityType entityType)Returns the ORCID synchronization preference related to the given entity type configured for the given profile item.List<OrcidProfileSyncPreference>getProfilePreferences(Item profile)Returns the ORCID synchronization preferences related to the profile itself configured for the given profile item.Optional<OrcidSynchronizationMode>getSynchronizationMode(Item profile)Returns the ORCID synchronization mode configured for the given profile item.booleanisLinkedToOrcid(Context context, Item item)Check if the given item is linked to an ORCID profile.booleanisSynchronizationAllowed(Item profile, Item item)Check if the given researcher profile item is configured to synchronize the given item with ORCID.voidlinkProfile(Context context, Item profile, OrcidTokenResponseDTO token)Configure the given profile with the data present in the given ORCID token.booleansetEntityPreference(Context context, Item profile, OrcidEntityType entityType, OrcidEntitySyncPreference value)Set the synchronization preference for the given profile related to the given ORCID entity type.booleansetProfilePreference(Context context, Item profile, List<OrcidProfileSyncPreference> values)Update the profile's synchronization preference for the given profile.booleansetSynchronizationMode(Context context, Item profile, OrcidSynchronizationMode value)Set the ORCID synchronization mode for the given profile.voidunlinkProfile(Context context, Item profile)Disconnect the given profile from ORCID.
-
-
-
Method Detail
-
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 configuretoken- 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 updateentityType- the orcid entity typevalue- 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 updateIllegalArgumentException- 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 updatevalues- 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 updateIllegalArgumentException- 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 updatevalue- 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 itemitem- 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 itementityType- 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
-
-