Package org.dspace.orcid.client
Class OrcidClientImpl
- java.lang.Object
-
- org.dspace.orcid.client.OrcidClientImpl
-
- All Implemented Interfaces:
OrcidClient
public class OrcidClientImpl extends Object implements OrcidClient
Implementation ofOrcidClient.- Author:
- Luca Giamminonni (luca.giamminonni at 4science.it)
-
-
Constructor Summary
Constructors Constructor Description OrcidClientImpl(OrcidConfiguration orcidConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrcidResponsedeleteByPutCode(String accessToken, String orcid, String putCode, String path)Delete the ORCID object with the given putCode on the given path.OrcidTokenResponseDTOgetAccessToken(String code)Exchange the authorization code for an ORCID iD and 3-legged access token.<T> Optional<T>getObject(String orcid, String putCode, Class<T> clazz)Retrieves an object from ORCID with the given putCode related to the given orcid using the public API.<T> Optional<T>getObject(String accessToken, String orcid, String putCode, Class<T> clazz)Retrieves an object from ORCID with the given putCode related to the given orcid.org.orcid.jaxb.model.v3.release.record.PersongetPerson(String accessToken, String orcid)Retrieves a summary of the ORCID person related to the given orcid.OrcidTokenResponseDTOgetReadPublicAccessToken()Retrieves an /read-public access token using a client-credentials OAuth flow, or 2-step OAuth.org.orcid.jaxb.model.v3.release.record.WorkBulkgetWorkBulk(String accessToken, String orcid, List<String> putCodes)Retrieves all the works with the given putCodes related to the given orcidorg.orcid.jaxb.model.v3.release.record.WorkBulkgetWorkBulk(String orcid, List<String> putCodes)Retrieves all the works with the given putCodes related to the given orcidorg.orcid.jaxb.model.v3.release.record.summary.WorksgetWorks(String orcid)Retrieves all the works related to the given orcid.org.orcid.jaxb.model.v3.release.record.summary.WorksgetWorks(String accessToken, String orcid)Retrieves all the works related to the given orcid.OrcidResponsepush(String accessToken, String orcid, Object object)Push the given object to ORCID.OrcidResponseupdate(String accessToken, String orcid, Object object, String putCode)Update the object with the given putCode.
-
-
-
Constructor Detail
-
OrcidClientImpl
public OrcidClientImpl(OrcidConfiguration orcidConfiguration)
-
-
Method Detail
-
getAccessToken
public OrcidTokenResponseDTO getAccessToken(String code)
Description copied from interface:OrcidClientExchange the authorization code for an ORCID iD and 3-legged access token. The authorization code expires upon use.- Specified by:
getAccessTokenin interfaceOrcidClient- Parameters:
code- the authorization code- Returns:
- the ORCID token
-
getPerson
public org.orcid.jaxb.model.v3.release.record.Person getPerson(String accessToken, String orcid)
Description copied from interface:OrcidClientRetrieves a summary of the ORCID person related to the given orcid.- Specified by:
getPersonin interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid id of the record to retrieve- Returns:
- the Person
-
getWorks
public org.orcid.jaxb.model.v3.release.record.summary.Works getWorks(String accessToken, String orcid)
Description copied from interface:OrcidClientRetrieves all the works related to the given orcid.- Specified by:
getWorksin interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid id related to the works- Returns:
- the Works
-
getWorks
public org.orcid.jaxb.model.v3.release.record.summary.Works getWorks(String orcid)
Description copied from interface:OrcidClientRetrieves all the works related to the given orcid.- Specified by:
getWorksin interfaceOrcidClient- Parameters:
orcid- the orcid id related to the works- Returns:
- the Works
-
getWorkBulk
public org.orcid.jaxb.model.v3.release.record.WorkBulk getWorkBulk(String accessToken, String orcid, List<String> putCodes)
Description copied from interface:OrcidClientRetrieves all the works with the given putCodes related to the given orcid- Specified by:
getWorkBulkin interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid idputCodes- the putCodes of the works to retrieve- Returns:
- the Works
-
getWorkBulk
public org.orcid.jaxb.model.v3.release.record.WorkBulk getWorkBulk(String orcid, List<String> putCodes)
Description copied from interface:OrcidClientRetrieves all the works with the given putCodes related to the given orcid- Specified by:
getWorkBulkin interfaceOrcidClient- Parameters:
orcid- the orcid idputCodes- the putCodes of the works to retrieve- Returns:
- the Works
-
getObject
public <T> Optional<T> getObject(String accessToken, String orcid, String putCode, Class<T> clazz)
Description copied from interface:OrcidClientRetrieves an object from ORCID with the given putCode related to the given orcid.- Specified by:
getObjectin interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid idputCode- the object's put codeclazz- the object's class- Returns:
- the Object, if any
-
getObject
public <T> Optional<T> getObject(String orcid, String putCode, Class<T> clazz)
Description copied from interface:OrcidClientRetrieves an object from ORCID with the given putCode related to the given orcid using the public API.- Specified by:
getObjectin interfaceOrcidClient- Parameters:
orcid- the orcid idputCode- the object's put codeclazz- the object's class- Returns:
- the Object, if any
-
push
public OrcidResponse push(String accessToken, String orcid, Object object)
Description copied from interface:OrcidClientPush the given object to ORCID.- Specified by:
pushin interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid idobject- the orcid object to push- Returns:
- the orcid response if no error occurs
-
update
public OrcidResponse update(String accessToken, String orcid, Object object, String putCode)
Description copied from interface:OrcidClientUpdate the object with the given putCode.- Specified by:
updatein interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid idobject- the orcid object to pushputCode- the put code of the resource to delete- Returns:
- the orcid response if no error occurs
-
deleteByPutCode
public OrcidResponse deleteByPutCode(String accessToken, String orcid, String putCode, String path)
Description copied from interface:OrcidClientDelete the ORCID object with the given putCode on the given path.- Specified by:
deleteByPutCodein interfaceOrcidClient- Parameters:
accessToken- the access tokenorcid- the orcid idputCode- the put code of the resource to deletepath- the path of the resource to delete- Returns:
- the orcid response if no error occurs
-
getReadPublicAccessToken
public OrcidTokenResponseDTO getReadPublicAccessToken()
Description copied from interface:OrcidClientRetrieves an /read-public access token using a client-credentials OAuth flow, or 2-step OAuth.- Specified by:
getReadPublicAccessTokenin interfaceOrcidClient- Returns:
- the ORCID token
-
-