Package org.dspace.orcid.service.impl
Class OrcidHistoryServiceImpl
- java.lang.Object
-
- org.dspace.orcid.service.impl.OrcidHistoryServiceImpl
-
- All Implemented Interfaces:
OrcidHistoryService
public class OrcidHistoryServiceImpl extends Object implements OrcidHistoryService
Implementation ofOrcidHistoryService.- Author:
- Mykhaylo Boychuk (mykhaylo.boychuk at 4science.it), Luca Giamminonni (luca.giamminonni at 4science.it)
-
-
Constructor Summary
Constructors Constructor Description OrcidHistoryServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrcidHistorycreate(Context context, Item profileItem, Item entity)Create a new OrcidHistory records related to the given profileItem and entity items.voiddelete(Context context, OrcidHistory orcidHistory)Delete an OrcidHistoryOrcidHistoryfind(Context context, int id)Get an OrcidHistory from the database.List<OrcidHistory>findAll(Context context)Find all the ORCID history records.List<OrcidHistory>findByEntity(Context context, Item entity)Find the OrcidHistory records related to the given entity item.List<OrcidHistory>findByProfileItemOrEntity(Context context, Item profileItem)Get the OrcidHistory records where the given item is the profile item OR the entityOptional<String>findLastPutCode(Context context, Item profileItem, Item entity)Find the last put code related to the given profileItem and entity item.Map<Item,String>findLastPutCodes(Context context, Item entity)Find all the last put code related to the entity item each associated with the profileItem to which it refers.List<OrcidHistory>findSuccessfullyRecordsByEntityAndType(Context context, Item entity, String recordType)Find all the successfully Orcid history records with the given record type related to the given entity.OrcidClientgetOrcidClient()voidsetOrcidClient(OrcidClient orcidClient)OrcidHistorysynchronizeWithOrcid(Context context, OrcidQueue orcidQueue, boolean forceAddition)Synchronize the entity related to the given orcidQueue record with ORCID.voidupdate(Context context, OrcidHistory orcidHistory)Update the OrcidHistory
-
-
-
Method Detail
-
find
public OrcidHistory find(Context context, int id) throws SQLException
Description copied from interface:OrcidHistoryServiceGet an OrcidHistory from the database.- Specified by:
findin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectid- ID of the OrcidHistory- Returns:
- the OrcidHistory format, or null if the ID is invalid.
- Throws:
SQLException- if database error
-
findAll
public List<OrcidHistory> findAll(Context context) throws SQLException
Description copied from interface:OrcidHistoryServiceFind all the ORCID history records.- Specified by:
findAllin interfaceOrcidHistoryService- Parameters:
context- DSpace context object- Returns:
- the ORCID history records
- Throws:
SQLException- if an SQL error occurs
-
findByProfileItemOrEntity
public List<OrcidHistory> findByProfileItemOrEntity(Context context, Item profileItem) throws SQLException
Description copied from interface:OrcidHistoryServiceGet the OrcidHistory records where the given item is the profile item OR the entity- Specified by:
findByProfileItemOrEntityin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectprofileItem- the item to search for- Returns:
- the found OrcidHistory entities
- Throws:
SQLException- if database error
-
create
public OrcidHistory create(Context context, Item profileItem, Item entity) throws SQLException
Description copied from interface:OrcidHistoryServiceCreate a new OrcidHistory records related to the given profileItem and entity items.- Specified by:
createin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity item- Returns:
- the created orcid history record
- Throws:
SQLException- if database error
-
delete
public void delete(Context context, OrcidHistory orcidHistory) throws SQLException
Description copied from interface:OrcidHistoryServiceDelete an OrcidHistory- Specified by:
deletein interfaceOrcidHistoryService- Parameters:
context- contextorcidHistory- the OrcidHistory entity to delete- Throws:
SQLException- if database error
-
update
public void update(Context context, OrcidHistory orcidHistory) throws SQLException
Description copied from interface:OrcidHistoryServiceUpdate the OrcidHistory- Specified by:
updatein interfaceOrcidHistoryService- Parameters:
context- contextorcidHistory- the OrcidHistory entity to update- Throws:
SQLException- if database error
-
findLastPutCode
public Optional<String> findLastPutCode(Context context, Item profileItem, Item entity) throws SQLException
Description copied from interface:OrcidHistoryServiceFind the last put code related to the given profileItem and entity item.- Specified by:
findLastPutCodein interfaceOrcidHistoryService- Parameters:
context- DSpace context objectprofileItem- the profileItem itementity- the entity item- Returns:
- the found put code, if any
- Throws:
SQLException- if database error
-
findLastPutCodes
public Map<Item,String> findLastPutCodes(Context context, Item entity) throws SQLException
Description copied from interface:OrcidHistoryServiceFind all the last put code related to the entity item each associated with the profileItem to which it refers.- Specified by:
findLastPutCodesin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectentity- the entity item- Returns:
- a map that relates the profileItems with the identified putCode
- Throws:
SQLException- if database error
-
findByEntity
public List<OrcidHistory> findByEntity(Context context, Item entity) throws SQLException
Description copied from interface:OrcidHistoryServiceFind the OrcidHistory records related to the given entity item.- Specified by:
findByEntityin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectentity- the entity item- Returns:
- the found put codes
- Throws:
SQLException- if database error
-
findSuccessfullyRecordsByEntityAndType
public List<OrcidHistory> findSuccessfullyRecordsByEntityAndType(Context context, Item entity, String recordType) throws SQLException
Description copied from interface:OrcidHistoryServiceFind all the successfully Orcid history records with the given record type related to the given entity. An history record is considered successful if the status is between 200 and 300.- Specified by:
findSuccessfullyRecordsByEntityAndTypein interfaceOrcidHistoryService- Parameters:
context- DSpace context objectentity- the entity itemrecordType- the record type- Returns:
- the found orcid history records
- Throws:
SQLException- if database error
-
synchronizeWithOrcid
public OrcidHistory synchronizeWithOrcid(Context context, OrcidQueue orcidQueue, boolean forceAddition) throws SQLException
Description copied from interface:OrcidHistoryServiceSynchronize the entity related to the given orcidQueue record with ORCID.- Specified by:
synchronizeWithOrcidin interfaceOrcidHistoryService- Parameters:
context- DSpace context objectorcidQueue- the orcid queue record that has the references of the data to be synchronizedforceAddition- to force the insert on the ORCID registry- Returns:
- the created orcid history record with the synchronization result
- Throws:
SQLException- if database error
-
getOrcidClient
public OrcidClient getOrcidClient()
-
setOrcidClient
public void setOrcidClient(OrcidClient orcidClient)
-
-