Class OrcidClientImpl

  • All Implemented Interfaces:
    OrcidClient

    public class OrcidClientImpl
    extends Object
    implements OrcidClient
    Implementation of OrcidClient.
    Author:
    Luca Giamminonni (luca.giamminonni at 4science.it)
    • Constructor Detail

    • Method Detail

      • getAccessToken

        public OrcidTokenResponseDTO getAccessToken​(String code)
        Description copied from interface: OrcidClient
        Exchange the authorization code for an ORCID iD and 3-legged access token. The authorization code expires upon use.
        Specified by:
        getAccessToken in interface OrcidClient
        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: OrcidClient
        Retrieves a summary of the ORCID person related to the given orcid.
        Specified by:
        getPerson in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - 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: OrcidClient
        Retrieves all the works related to the given orcid.
        Specified by:
        getWorks in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - 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: OrcidClient
        Retrieves all the works related to the given orcid.
        Specified by:
        getWorks in interface OrcidClient
        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: OrcidClient
        Retrieves all the works with the given putCodes related to the given orcid
        Specified by:
        getWorkBulk in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCodes - 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: OrcidClient
        Retrieves all the works with the given putCodes related to the given orcid
        Specified by:
        getWorkBulk in interface OrcidClient
        Parameters:
        orcid - the orcid id
        putCodes - 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: OrcidClient
        Retrieves an object from ORCID with the given putCode related to the given orcid.
        Specified by:
        getObject in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCode - the object's put code
        clazz - 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: OrcidClient
        Retrieves an object from ORCID with the given putCode related to the given orcid using the public API.
        Specified by:
        getObject in interface OrcidClient
        Parameters:
        orcid - the orcid id
        putCode - the object's put code
        clazz - the object's class
        Returns:
        the Object, if any
      • push

        public OrcidResponse push​(String accessToken,
                                  String orcid,
                                  Object object)
        Description copied from interface: OrcidClient
        Push the given object to ORCID.
        Specified by:
        push in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        object - 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: OrcidClient
        Update the object with the given putCode.
        Specified by:
        update in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        object - the orcid object to push
        putCode - 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: OrcidClient
        Delete the ORCID object with the given putCode on the given path.
        Specified by:
        deleteByPutCode in interface OrcidClient
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCode - the put code of the resource to delete
        path - the path of the resource to delete
        Returns:
        the orcid response if no error occurs