Package org.dspace.orcid.service.impl
Class OrcidQueueServiceImpl
- java.lang.Object
-
- org.dspace.orcid.service.impl.OrcidQueueServiceImpl
-
- All Implemented Interfaces:
OrcidQueueService
public class OrcidQueueServiceImpl extends Object implements OrcidQueueService
Implementation ofOrcidQueueService.- Author:
- Luca Giamminonni (luca.giamminonni at 4science.it)
-
-
Constructor Summary
Constructors Constructor Description OrcidQueueServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcountByProfileItemId(Context context, UUID profileItemId)Returns the number of records on the OrcidQueue associated with the given profileItemId.OrcidQueuecreate(Context context, Item profileItem, Item entity)Create an OrcidQueue record with the given profileItem and entity.OrcidQueuecreateEntityDeletionRecord(Context context, Item profileItem, String description, String type, String putCode)Create an OrcidQueue record with the given profileItem to delete a record on ORCID related to the given entity type with the given putCode.OrcidQueuecreateEntityInsertionRecord(Context context, Item profileItem, Item entity)Create an OrcidQueue record with the given profileItem and entity to push new data to ORCID.OrcidQueuecreateEntityUpdateRecord(Context context, Item profileItem, Item entity, String putCode)Create an OrcidQueue record with the given profileItem to update a record on ORCID with the given putCode.OrcidQueuecreateProfileDeletionRecord(Context context, Item profile, String description, String recordType, String metadata, String putCode)Create an OrcidQueue record with the profile to remove data from ORCID.OrcidQueuecreateProfileInsertionRecord(Context context, Item profile, String description, String recordType, String metadata)Create an OrcidQueue record with the profile to add data to ORCID.voiddelete(Context context, OrcidQueue orcidQueue)Delete an OrcidQueuevoiddeleteByEntityAndRecordType(Context context, Item entity, String recordType)Delete all the OrcidQueue records with the given entity and record type.voiddeleteById(Context context, Integer id)Delete the OrcidQueue record with the given id.voiddeleteByProfileItemAndRecordType(Context context, Item profileItem, String recordType)Delete all the OrcidQueue records with the given profileItem and record type.OrcidQueuefind(Context context, int id)Get an OrcidQueue from the database.List<OrcidQueue>findAll(Context context)Find all the ORCID queue records.List<OrcidQueue>findByAttemptsLessThan(Context context, int attempts)Get all the OrcidQueue records with attempts less than the given attempts.List<OrcidQueue>findByProfileItemAndEntity(Context context, Item profileItem, Item entity)Get the orcid queue records by the profileItem and entity.List<OrcidQueue>findByProfileItemId(Context context, UUID profileItemId)Get the orcid queue records by the profileItem id.List<OrcidQueue>findByProfileItemId(Context context, UUID profileItemId, Integer limit, Integer offset)Get the orcid queue records by the profileItem id.List<OrcidQueue>findByProfileItemOrEntity(Context context, Item item)Get the OrcidQueue records where the given item is the profileItem OR the entityvoidrecalculateOrcidQueue(Context context, Item profileItem, OrcidEntityType orcidEntityType, OrcidEntitySyncPreference preference)Recalculates the ORCID queue records linked to the given profileItem as regards the entities of the given type.voidupdate(Context context, OrcidQueue orcidQueue)Update the OrcidQueue
-
-
-
Method Detail
-
findByProfileItemId
public List<OrcidQueue> findByProfileItemId(Context context, UUID profileItemId) throws SQLException
Description copied from interface:OrcidQueueServiceGet the orcid queue records by the profileItem id.- Specified by:
findByProfileItemIdin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItemId- the profileItem item id- Returns:
- the orcid queue records
- Throws:
SQLException- if an SQL error occurs
-
findByProfileItemId
public List<OrcidQueue> findByProfileItemId(Context context, UUID profileItemId, Integer limit, Integer offset) throws SQLException
Description copied from interface:OrcidQueueServiceGet the orcid queue records by the profileItem id.- Specified by:
findByProfileItemIdin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItemId- the profileItem item idlimit- limitoffset- offset- Returns:
- the orcid queue records
- Throws:
SQLException- if an SQL error occurs
-
findByProfileItemAndEntity
public List<OrcidQueue> findByProfileItemAndEntity(Context context, Item profileItem, Item entity) throws SQLException
Description copied from interface:OrcidQueueServiceGet the orcid queue records by the profileItem and entity.- Specified by:
findByProfileItemAndEntityin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity item- Returns:
- the found OrcidQueue records
- Throws:
SQLException- if an SQL error occurs
-
findByProfileItemOrEntity
public List<OrcidQueue> findByProfileItemOrEntity(Context context, Item item) throws SQLException
Description copied from interface:OrcidQueueServiceGet the OrcidQueue records where the given item is the profileItem OR the entity- Specified by:
findByProfileItemOrEntityin interfaceOrcidQueueService- Parameters:
context- DSpace context objectitem- the item to search for- Returns:
- the found OrcidQueue records
- Throws:
SQLException- if database error
-
countByProfileItemId
public long countByProfileItemId(Context context, UUID profileItemId) throws SQLException
Description copied from interface:OrcidQueueServiceReturns the number of records on the OrcidQueue associated with the given profileItemId.- Specified by:
countByProfileItemIdin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItemId- the profileItem item id- Returns:
- the record's count
- Throws:
SQLException- if an SQL error occurs
-
findAll
public List<OrcidQueue> findAll(Context context) throws SQLException
Description copied from interface:OrcidQueueServiceFind all the ORCID queue records.- Specified by:
findAllin interfaceOrcidQueueService- Parameters:
context- DSpace context object- Returns:
- the ORCID queue records
- Throws:
SQLException- if an SQL error occurs
-
create
public OrcidQueue create(Context context, Item profileItem, Item entity) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the given profileItem and entity. The type of operation is calculated based on whether or not the given entity was already pushed to the ORCID registry.- Specified by:
createin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity item- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
createEntityInsertionRecord
public OrcidQueue createEntityInsertionRecord(Context context, Item profileItem, Item entity) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the given profileItem and entity to push new data to ORCID.- Specified by:
createEntityInsertionRecordin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity item- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
createEntityUpdateRecord
public OrcidQueue createEntityUpdateRecord(Context context, Item profileItem, Item entity, String putCode) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the given profileItem to update a record on ORCID with the given putCode.- Specified by:
createEntityUpdateRecordin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity itemputCode- the putCode related to the given entity item- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
createEntityDeletionRecord
public OrcidQueue createEntityDeletionRecord(Context context, Item profileItem, String description, String type, String putCode) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the given profileItem to delete a record on ORCID related to the given entity type with the given putCode.- Specified by:
createEntityDeletionRecordin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itemdescription- the orcid queue record descriptiontype- the type of the entity itemputCode- the putCode related to the given entity item- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
createProfileInsertionRecord
public OrcidQueue createProfileInsertionRecord(Context context, Item profile, String description, String recordType, String metadata) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the profile to add data to ORCID.- Specified by:
createProfileInsertionRecordin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofile- the profile itemdescription- the record descriptionrecordType- the record typemetadata- the metadata signature- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
createProfileDeletionRecord
public OrcidQueue createProfileDeletionRecord(Context context, Item profile, String description, String recordType, String metadata, String putCode) throws SQLException
Description copied from interface:OrcidQueueServiceCreate an OrcidQueue record with the profile to remove data from ORCID.- Specified by:
createProfileDeletionRecordin interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofile- the profile itemdescription- the record descriptionrecordType- the record typeputCode- the putCode- Returns:
- the stored record
- Throws:
SQLException- if an SQL error occurs
-
deleteById
public void deleteById(Context context, Integer id) throws SQLException
Description copied from interface:OrcidQueueServiceDelete the OrcidQueue record with the given id.- Specified by:
deleteByIdin interfaceOrcidQueueService- Parameters:
context- DSpace context objectid- the id of the record to be deleted- Throws:
SQLException- if an SQL error occurs
-
findByAttemptsLessThan
public List<OrcidQueue> findByAttemptsLessThan(Context context, int attempts) throws SQLException
Description copied from interface:OrcidQueueServiceGet all the OrcidQueue records with attempts less than the given attempts.- Specified by:
findByAttemptsLessThanin interfaceOrcidQueueService- Parameters:
context- DSpace context objectattempts- the maximum value of attempts- Returns:
- the found OrcidQueue records
- Throws:
SQLException- if database error
-
delete
public void delete(Context context, OrcidQueue orcidQueue) throws SQLException
Description copied from interface:OrcidQueueServiceDelete an OrcidQueue- Specified by:
deletein interfaceOrcidQueueService- Parameters:
context- DSpace context objectorcidQueue- the orcidQueue record to delete- Throws:
SQLException- if database error
-
deleteByEntityAndRecordType
public void deleteByEntityAndRecordType(Context context, Item entity, String recordType) throws SQLException
Description copied from interface:OrcidQueueServiceDelete all the OrcidQueue records with the given entity and record type.- Specified by:
deleteByEntityAndRecordTypein interfaceOrcidQueueService- Parameters:
context- DSpace context objectentity- the entity itemrecordType- the record type- Throws:
SQLException- if database error occurs
-
deleteByProfileItemAndRecordType
public void deleteByProfileItemAndRecordType(Context context, Item profileItem, String recordType) throws SQLException
Description copied from interface:OrcidQueueServiceDelete all the OrcidQueue records with the given profileItem and record type.- Specified by:
deleteByProfileItemAndRecordTypein interfaceOrcidQueueService- Parameters:
context- DSpace context objectprofileItem- the profileItem itemrecordType- the record type- Throws:
SQLException- if database error occurs
-
find
public OrcidQueue find(Context context, int id) throws SQLException
Description copied from interface:OrcidQueueServiceGet an OrcidQueue from the database.- Specified by:
findin interfaceOrcidQueueService- Parameters:
context- DSpace context objectid- ID of the OrcidQueue- Returns:
- the OrcidQueue format, or null if the ID is invalid.
- Throws:
SQLException- if database error
-
update
public void update(Context context, OrcidQueue orcidQueue) throws SQLException
Description copied from interface:OrcidQueueServiceUpdate the OrcidQueue- Specified by:
updatein interfaceOrcidQueueService- Parameters:
context- contextorcidQueue- the OrcidQueue to update- Throws:
SQLException- if database error
-
recalculateOrcidQueue
public void recalculateOrcidQueue(Context context, Item profileItem, OrcidEntityType orcidEntityType, OrcidEntitySyncPreference preference) throws SQLException
Description copied from interface:OrcidQueueServiceRecalculates the ORCID queue records linked to the given profileItem as regards the entities of the given type. The recalculation is done based on the preference indicated.- Specified by:
recalculateOrcidQueuein interfaceOrcidQueueService- Parameters:
context- contextprofileItem- the profileItemorcidEntityType- the entity type related to the records to recalculatepreference- the preference value on which to base the recalculation- Throws:
SQLException- if database error
-
-