Search in sources :

Example 6 with OrcidNotFoundException

use of org.orcid.core.exception.OrcidNotFoundException in project ORCID-Source by ORCID.

the class T2OrcidApiServiceDelegatorImpl method getOrcidMessageResponse.

/**
     * Method to perform the mundane task of checking for null and returning the
     * response with an OrcidMessage entity
     * 
     * @param profile
     * @param requestedOrcid
     * @return
     */
private Response getOrcidMessageResponse(OrcidProfile profile, String requestedOrcid) {
    if (profile != null) {
        OrcidMessage orcidMessage = new OrcidMessage(profile);
        orcidMessageUtil.setSourceName(orcidMessage);
        return Response.ok(orcidMessage).build();
    } else {
        Map<String, String> params = new HashMap<String, String>();
        params.put("orcid", requestedOrcid);
        throw new OrcidNotFoundException(params);
    }
}
Also used : HashMap(java.util.HashMap) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrcidNotFoundException(org.orcid.core.exception.OrcidNotFoundException)

Aggregations

HashMap (java.util.HashMap)6 OrcidNotFoundException (org.orcid.core.exception.OrcidNotFoundException)6 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)3 Authentication (org.springframework.security.core.Authentication)3 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)3 OAuth2Request (org.springframework.security.oauth2.provider.OAuth2Request)3 OrcidBadRequestException (org.orcid.core.exception.OrcidBadRequestException)2 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)2 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)2 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)2 WebhookEntity (org.orcid.persistence.jpa.entities.WebhookEntity)2 WebhookEntityPk (org.orcid.persistence.jpa.entities.keys.WebhookEntityPk)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Date (java.util.Date)1 Map (java.util.Map)1 Response (javax.ws.rs.core.Response)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 OrcidClientNotFoundException (org.orcid.core.exception.OrcidClientNotFoundException)1 OrcidDeprecatedException (org.orcid.core.exception.OrcidDeprecatedException)1